via.placeholder.com

Placeholder images

Put the size in the URL and get an image back. The syntax is the one placehold.it introduced in 2010, so old via.placeholder.com links work again.

URL syntax

https://via.placeholder.com/<size>[@2x][/<background>[/<text colour>]][.<format>][?text=<text>]
PartValuesDefault
size150 (square) or 600x400 (width × height, X works too). 1 to 4000 px per side.none, required
background3 or 6 digit hex without # (09f, ff6600) or a CSS colour name (navy, tomato)cccccc
text coloursame as background969696
format.png, .jpg / .jpeg, .gif, .webp, .svg, on any segment. .avif too, with one rule: see AVIF.png
scale@1x to @3x (also @1.5x) on the size segment: 600x400@2x. See Retina.@1x
text?text=, URL-encoded (+ or %20 for spaces). Up to 120 characters; runs of whitespace become one space.the size, e.g. 600 x 400

Examples

Retina: @2x and @3x

Add a scale to the size segment and you get more pixels with the same layout. 600x400@2x is a 1200 × 800 image that looks exactly like 600x400, just sharper, and its default text still reads 600 x 400.

AVIF

Put .avif on the size segment, or anywhere once the size segment carries a scale:

Watch out: /600x400/ff6600/fff.avif (no scale, extension on a colour) is a PNG with the default text colour. That URL already meant something before AVIF existed (fff.avif is not a colour), so it keeps its old answer.

In HTML and CSS

<img src="https://via.placeholder.com/600x400" width="600" height="400" alt="Product photo">

<img src="https://via.placeholder.com/400x300.webp"
     srcset="https://via.placeholder.com/[email protected] 2x, https://via.placeholder.com/[email protected] 3x"
     width="400" height="300" alt="">

<picture>
  <source type="image/avif" srcset="https://via.placeholder.com/400x300.avif, https://via.placeholder.com/[email protected] 2x">
  <img src="https://via.placeholder.com/400x300.jpg" width="400" height="300" alt="">
</picture>

.hero { background: url("https://via.placeholder.com/1600x600/eeeeee/999999.svg") center / cover; }

Always set width and height (or aspect-ratio) so the layout doesn't jump when the real image arrives.

Behaviour and limits

Response headers

HeaderValue
X-Placeholdervia.placeholder.com. Lets tests and monitoring tell placeholders from real assets.
Cache-Controlpublic, max-age=31536000, immutable
Access-Control-Allow-Origin*
Cross-Origin-Resource-Policycross-origin
X-Robots-Tagnoindex

Making sure they don't ship

These classic images keep their exact historical bytes, so unlike avatars and photos they carry no embedded marker. That includes the new retina PNG, JPEG, GIF, WebP and SVG variants. The one exception is AVIF: a classic .avif carries the marker in its XMP metadata. They are detectable by their URL and the X-Placeholder header. If you link to them, placeholder-check finds the URL in your build output. If you download one into your repository, nothing in the file gives it away, so prefer linking.

More on via.placeholder.com