The best image format for the web, by use case

There is no single best image format — there's a best format per job. The good news: in 2026 the decision table is short, stable and easy to memorise. This guide gives you the rule for each use case and the reasoning behind it, so you can also handle the edge cases.

The decision list

  • Photographs → WebP (or AVIF if your pipeline generates it). JPEG only when compatibility outside browsers matters.
  • Screenshots and UI images → PNG, or lossless WebP for ~25% smaller files.
  • Logos, icons, diagrams → SVG. Raster fallback: PNG or lossless WebP.
  • Images with transparency → WebP (lossy for photos with alpha, lossless for graphics); PNG where WebP isn't accepted.
  • Animation → MP4 video, not GIF. Animated WebP for short UI flourishes that must behave like an image.
  • Favicons → ICO + SVG (see the favicon guide).

Now the reasoning, case by case.

Photos: WebP by default, AVIF when you can

Photographic content — millions of subtly varying pixels — is what lossy codecs were built for. WebP delivers roughly 25–35% smaller files than JPEG at the same visual quality and has been supported by every major browser since Safari joined in 2020. AVIF goes further, commonly 20–50% smaller than WebP, and is likewise supported across all current major browsers — but it encodes much more slowly and its tooling is younger, which is why it makes most sense when a CDN or build step generates it automatically. The pecking order for a photo on a web page: AVIF, then WebP, then JPEG as the universal fallback via the <picture> element. If you maintain images by hand and want one format: WebP. The full trade-off analysis is in our AVIF vs WebP comparison.

Screenshots and UI: keep it lossless

Screenshots are the opposite of photos: large areas of perfectly flat colour, one-pixel borders, and lots of small text. Lossy codecs spend their bits mimicking photographic texture and produce fuzzy halos around exactly those crisp edges. Lossless formats compress flat regions extremely well and keep text pin-sharp. Use PNG — or lossless WebP, which averages about 25% smaller. The exception: a screenshot dominated by a photo or video frame behaves like a photo, so lossy WebP at quality 80+ can be fine. Zoom to 100% and check the text before committing.

Logos and icons: vectors beat pixels

A logo is drawn from shapes, and SVG stores the shapes themselves — so one small file renders perfectly at 16 px in a nav bar and at 400 px in a footer, on any screen density. It can be styled with CSS and usually weighs 1–5 KB. Serve raster (PNG or lossless WebP) only where SVG isn't accepted: certain email clients, upload forms, marketplaces and older apps. When you export raster versions, export at the exact display sizes needed rather than scaling one large file down in the browser.

Animation: GIF lost this fight years ago

GIF is a 1989 format limited to 256 colours and whole-frame storage, and it shows: a few seconds of screen recording easily becomes a 10–20 MB GIF. The same clip encoded as an MP4 (H.264) is typically 5–10× smaller, in full colour, with smoother playback — which is why every major social platform silently converts uploaded GIFs to video. On your own site, a muted, looping, autoplaying video replicates GIF behaviour exactly: <video autoplay loop muted playsinline>. Convert existing files with the GIF to MP4 converter. Animated WebP is the middle option when you genuinely need an image (for instance, where video embeds are stripped), and GIF itself survives only as a maximum-compatibility fallback.

Transparency: the deciding constraint

Transparency instantly eliminates JPEG. Your options are PNG, WebP and AVIF (full 8-bit alpha each), SVG for vectors, and GIF's crude on/off transparency, best avoided. The interesting case is a photo that needs a transparent background — a product cut-out, say: as PNG it might be 800 KB, as lossy WebP with alpha perhaps 60–90 KB. That single feature — lossy compression plus real transparency — is the strongest practical argument for WebP over the older formats; more detail in WebP vs PNG.

When compatibility overrides everything

Everything above assumes a browser is rendering the image. The moment a file leaves the web page — email attachments, documents, print shops, government portals, marketplace uploads — assume nothing beyond JPEG and PNG, which remain the only formats that open truly everywhere. It's normal to keep two versions: a modern format for your site, a JPEG/PNG for everything else.

Frequently asked questions

What is the best image format for website speed?

AVIF produces the smallest files, WebP is a close second with more mature tooling. Either beats JPEG/PNG substantially. But format is step two — resizing images to their actual display dimensions saves more than any codec choice; see how to reduce image file size.

Should I still use JPEG at all?

Yes — as the compatibility format: <picture> fallbacks, email, uploads to third-party systems, and anywhere you can't verify WebP support. As the primary format on your own site, it's outclassed.

Is PNG or JPEG better for quality?

PNG is lossless, so technically it's perfect — but for photos that perfection costs 5–10× the file size. Use PNG where losslessness matters (graphics, text, transparency masters) and a well-encoded lossy format for photographs, where the difference is invisible.

Do WebP or AVIF images hurt SEO?

No — Google indexes both in Image Search and has recommended modern formats in its page-speed guidance for years. Faster-loading pages help Core Web Vitals, which is a ranking consideration; just keep descriptive filenames and alt text as with any format.

Related guides

  • WebP vs PNG — the head-to-head with file-size examples.
  • AVIF vs WebP — when the extra compression is worth the extra friction.