JPEG is 34 years old. It has no transparency, no animation and no idea what HDR means, and it still opens on every device ever made. That compatibility is the only reason it is still here, and it is a very good reason.
AVIF is roughly half the size for the same picture and now works in every browser that matters. WebP sits in the middle, older and faster to encode. Choosing between them is mostly a question of who has to open the file and how many of them you have.
The three, briefly
JPEG arrived in 1992 and compresses by throwing away detail the eye is bad at noticing. It is lossy, it is everywhere, and every camera, printer and photo lab speaks it.
WebP arrived in 2010 from Google, with a lossy mode, a lossless mode, transparency and animation. It became universal when Safari 14 shipped in 2020, which is the point at which “use WebP” stopped being a gamble.
AVIF arrived in 2019, built on the AV1 video codec. It does lossy and lossless, transparency, animation, HDR and wide colour. Chrome and Firefox had it by 2021; Safari 16.4 in 2023 closed the gap.
| Format | Since | Transparency | Animation | HDR | Typical saving vs JPEG | Browser support |
|---|---|---|---|---|---|---|
| JPEG | 1992 | No | No | No | — | Everything |
| WebP | 2010 | Yes | Yes | No | 25–35% | Universal since 2020 |
| AVIF | 2019 | Yes | Yes | Yes | 30–50% | Universal since 2023 |
The percentages are ranges on purpose. A photograph of a forest compresses very differently from a screenshot of text, and an encoder set to “fast” produces a bigger file than the same encoder set to “slow”. Anyone quoting a single number is quoting their own test image.
The catch nobody mentions
AVIF takes a long time to encode. Not a catastrophic amount, but on the order of seconds per large image where JPEG takes milliseconds. Compress ten photos and you will not notice. Compress ten thousand and you have a build that used to take four minutes and now takes an afternoon.
That is why the format you serve and the format you store are different decisions. Sites serve AVIF and keep the original JPEG or RAW, because re-encoding an archive is a project and re-encoding a delivery copy is a cron job.
The second catch is tooling. Phones shoot HEIC, which is neither of the above and which most browsers will not display. If someone sends you an iPhone photo and it does not open in the browser, that is why. Converting it to JPEG or WebP is a two-second job with the image format converter, and it is not optional if the photo is going on a website.
What to use for what
| You are doing this | Use this |
|---|---|
| Photos on a website | AVIF, with WebP or JPEG as a fallback |
| Sending photos to a printer | JPEG at high quality, or TIFF if the lab asks |
| Screenshot with text | PNG — lossy formats make text look bruised |
| Logo or sticker with transparency | PNG, or WebP lossless |
| Animated anything | WebP, or a video if it is more than a second |
| Archiving a shoot | RAW or the original JPEG, never a re-encode |
| A 20 KB icon | Whatever loads, the difference is a rounding error |
That last row matters more than it looks. The format wins are proportional: halving a 3 MB photo saves 1.5 MB, and halving a 20 KB favicon saves 10 KB. If a page is slow, resizing the hero image does more than any codec.
The 2027 answer
AVIF is safe to serve now, and the fallback costs one <picture> element. WebP is the conservative choice if you have an old pipeline or a client who insists. JPEG is what you send to people, because it is the only one that never needs an explanation.
But the biggest improvement is usually not the format. It is sending an 800-pixel image instead of a 4000-pixel one. The image resizer does that, the compressor does the quality pass, and compress image to size hits a target in kilobytes when a form or a shop insists on one.
If you are also working out what fits on a card, the 256 GB photo table is the same arithmetic with a camera attached.
The best format is the one that loads. Everything else is a compression ratio.
Hero photo: Colorful Gradient, CC0, via Openverse (StockSnap).
