The measured case
Every figure below is produced by this site’s own converters from a single source image, over a fixed corpus.
| Format | Size | vs JPG |
|---|---|---|
| PNG | 3.97 MB | 10× larger |
| JPG | 375 KB | baseline |
| WebP | 247 KB | 34% smaller |
| AVIF | 109 KB | 71% smaller |
On a page with ten photographs, that is the difference between roughly 3.7 MB and roughly 1.1 MB of image weight. On a phone connection, that is seconds.
The answer
<picture>
<source srcset="hero.avif" type="image/avif" />
<source srcset="hero.webp" type="image/webp" />
<img src="hero.jpg" alt="A real description" width="1200" height="800" />
</picture>
The browser takes the first format it understands. Current browsers get AVIF. Slightly older ones get WebP. Anything else gets JPG. No visitor is ever stuck, and nobody downloads more than they need.
Two details in that snippet matter beyond the format choice:
widthandheightreserve the space before the image loads, which prevents the layout shifting underneath the reader. Cumulative Layout Shift is a Core Web Vital.altis a real description, not a filename. It is what screen readers announce and what search engines read.
If three versions is too much work
Two is a reasonable compromise: WebP with a JPG fallback. That covers essentially every visitor, is much simpler to generate, and still takes 34% off your image weight.
The full three-format setup is worth it when images are the bulk of the page — a portfolio, a photography site, a product catalogue — and less so when you have four images on a text-heavy blog.
Where the rule changes
Screenshots, diagrams and code samples → PNG, optimised losslessly. Lossy compression softens text, and no quality setting fully avoids it. This is the one case where the largest file is the right answer.
Logos, icons and line art → SVG. It is a vector description rather than pixels, so it is sharp at any size and usually smaller than any raster equivalent. This site does not convert SVG, but if your artwork is geometric, that is where it belongs.
Images your visitors will download → offer a JPG. You control what their browser renders; you do not control what opens the file after they save it.
Size matters more than format
Worth saying, because it is easy to spend an afternoon on formats and miss the bigger win.
An image displayed in a 600-pixel column should be about 1200 pixels wide — twice the display size, to look sharp on high-density screens. Serving a 4000-pixel camera original into that column wastes far more bytes than any format choice can recover.
Resize first, then convert. In that order.
The practical sequence
- Resize to twice the largest displayed width
- Convert to AVIF and WebP, keeping a JPG fallback
- Serve them from a
<picture>element withwidth,heightand realalttext - Lazy-load everything below the fold — but never your largest above-the-fold image, which is the one Largest Contentful Paint is measuring
Converters for step two: to AVIF, to WebP, and from PNG or HEIC if that is where you are starting.