API Reference

Placeholder Images

URL Pattern

https://freeplaceholder.com/{width}x{height}[.format]

Path Parameters

PartRequiredDescription
widthYesImage width in pixels (1–4096)
heightYesImage height in pixels (1–4096)
formatNoFile extension: svg, png, jpg, webp (default: svg)

Query Parameters

All query parameters are named after Tailwind CSS utility classes.

ParameterDescriptionExample
bgBackground color (hex, no #)?bg=3b82f6
gradientGradient direction?gradient=to-r
fromGradient start color (hex, no #)?from=3b82f6
viaGradient middle color (hex, no #)?via=8b5cf6
toGradient end color (hex, no #)?to=ec4899
text-colorText color (hex, no #)?text-color=ffffff
textCustom text overlay?text=Loading...
text-sizeFont size in pixels?text-size=48
text-alignText alignment (left, center, right)?text-align=center
text-transformText transform (uppercase, lowercase, capitalize)?text-transform=uppercase
text-decorationText decoration (underline, overline, line-through)?text-decoration=underline
letter-spacingLetter spacing (Tailwind values or px)?letter-spacing=wide
font-weightFont weight (Tailwind values)?font-weight=bold
opacityOpacity 0–100?opacity=50
blurGaussian blur in px (0–100)?blur=5
brightnessBrightness 0–200 (100 = normal)?brightness=120
contrastContrast 0–200 (100 = normal)?contrast=110
hue-rotateHue rotation 0–360 degrees?hue-rotate=90
invertInvert colors?invert=true
saturateSaturation 0–200 (100 = normal)?saturate=150
sepiaSepia tone filter?sepia=true
grayscaleGrayscale filter?grayscale=true
borderBorder width in px?border=2
border-colorBorder color (hex, no #)?border-color=000000
border-styleBorder style (solid, dashed, dotted, double, none)?border-style=dashed
roundedBorder radius (sm, md, lg, xl, 2xl, 3xl, full, or px)?rounded=lg
formatOutput format (overrides extension)?format=png

Examples

URLDescription
/600x400600x400 SVG with auto colors
/600x400.png600x400 PNG
/1920x1080.webpFull HD WebP
/600x400?bg=3b82f6&text-color=ffffffBlue bg, white text
/300x200?text=Banner&text-size=32Custom text

Avatars

URL Pattern

https://freeplaceholder.com/avatar/{name}[.format]

Parameters

PartRequiredDescription
nameYesName to derive initials from (URL-encoded)
formatNoFile extension: svg, png, jpg, webp (default: svg)

Query Parameters

ParameterDescriptionDefaultExample
sizeSquare dimensions in pixels (1–1024)128?size=256
bgBackground color (hex, no #)Auto?bg=6366f1
text-colorText color (hex, no #)Auto?text-color=ffffff
text-decorationText decoration (underline, overline, line-through)none?text-decoration=underline
letter-spacingLetter spacing (Tailwind values or px)Auto?letter-spacing=wide
font-weightFont weight (Tailwind values)semibold?font-weight=bold
opacityOpacity 0–100100?opacity=50
blurGaussian blur in px (0–100)0?blur=5
brightnessBrightness 0–200 (100 = normal)100?brightness=120
contrastContrast 0–200 (100 = normal)100?contrast=110
hue-rotateHue rotation 0–360 degrees0?hue-rotate=90
invertInvert colorsfalse?invert=true
saturateSaturation 0–200 (100 = normal)100?saturate=150
sepiaSepia tone filterfalse?sepia=true
grayscaleGrayscale filterfalse?grayscale=true
borderBorder width in px0?border=2
border-colorBorder color (hex, no #)Auto?border-color=000000
border-styleBorder stylesolid?border-style=dashed
roundedBorder radius (sm, md, lg, xl, 2xl, 3xl, full, or px)0?rounded=lg
formatOutput formatsvg?format=png

Examples

URLDescription
/avatar/John+Doe"JD" initials, auto colors
/avatar/alice.pngSingle initial "A", PNG
/avatar/Bob?size=256&bg=ef4444&text-color=ffffffRed, 256px

Color Hashing

When bg and text-color are not provided, the API deterministically generates colors from the URL path using a DJB2 hash mapped to the HSL color space. The text color is automatically chosen for WCAG AA contrast compliance.

Caching

All image responses include:

Cache-Control: public, max-age=31536000, s-maxage=31536000, immutable

Images are served through CloudFront CDN. Identical URLs always produce identical images, so caching is safe and permanent.

Response Codes

CodeMeaning
200Image generated successfully
400Invalid parameters (bad dimensions, unsupported format)
500Server error during image generation