Reference guide · images · Published 2026-08-16 · 3 min read

AVIF vs WebP formats

AVIF vs WebP image formats: compression, browser support, encoding cost and when to use each for smaller faster images.

Both AVIF and WebP are modern formats that replace JPEG and PNG. WebP is the safe default because every modern browser decodes it; AVIF is usually smaller but less universal, so it ships best as the first-choice format with WebP as the fallback. The trade-off between them is compression versus support, and both beat JPEG for the same visual quality.

The two formats

FormatBaseWhat it is good atWeak spot
WebPLossy + lossless, via VP8/VP9Photos at high compression, simple pagesLarger than AVIF at the same quality
AVIFHEVC-based, AV1 imageThe best ratio for photos by a wide marginOld browser support, slower to encode

Quality and size

At "visually indistinguishable from the original", an AVIF file is typically 20 to 50 percent smaller than a WebP for a photo, and both beat a JPEG by a large margin. On line art, logos and flat-color UI, the gap narrows; a lossless PNG derived format often wins there, so the win is for photos and gradients.

ContentOrder that wins for weight
Photos, gradientsAVIF > WebP > JPEG
Flat logos, iconsPNG (or SVG where allowed)
AnimatedWebP (or AVIF) for short loops

Support and serving

<picture>
  <source srcset="photo.avif" type="image/avif">
  <source srcset="photo.webp" type="image/webp">
  <img src="photo.jpg" alt="..." width="1200" height="800">
</picture>

Encoding costs

AVIF encoding is heavier than WebP. A one-off conversion of a small product image is similar, but a whole media library (10,000 originals) can be an order of magnitude slower with AVIF. Size your pipeline: run AVIF for the subset (hero, previews), keep WebP for scale, or use a service like a CDN image API that does the encoding on demand.

Deciding for your site

  1. Check your visitors' browsers over the last 90 days. If every main browser your logs show supports AVIF, ship AVIF first for photos.
  2. Keep WebP as the fallback and your originals as JPEG/PNG (you always keep the master).
  3. Test with real sizes, not marketing numbers: compare a page with JPEG vs WebP vs AVIF and weigh the median. See image compression for the size budget.
  4. Serve with width/height set (the aspect ratio article shows why) and let the browser pick.

When to involve a professional

If encoding your whole media library to AVIF turns out slower than your deploy cycle, the right move is an image pipeline (a build step or a CDN that resizes on the fly), which a performance engineer or your host can set up. Do not hand-curate 10,000 images twice a year; that is a leak that costs more than the format saves.

Need a website built, fixed, optimised, migrated or replaced?

This technical resource is written by CSMBAC, a small design and development studio. If you would rather hand the problem to a professional, the website service page explains how we build enquiry-ready websites.

Explore website services