WebP vs AVIF vs JPG

Which format makes the smallest file, which looks best, and which will actually open for your visitors. With a live test of the browser you’re using now.

At a glance

JPEGWebPAVIF
Based on1992 DCT standardVP8 video codec (Google, 2010)AV1 video codec (AOMedia, 2019)
Photo size at equal qualityBaselineUsually smallerUsually smallest
TransparencyNoYesYes
Lossless modeNoYesYes
AnimationNoYesYes
HDR / 10-bitNoNoYes
Encoding speedFastFastSlow
Opens everywhereYesAll current browsers; some older apps noCurrent browsers; older Safari/Edge and many apps no

What your browser supports

Why AVIF is often smaller

AVIF borrows AV1’s toolbox: blocks from 4×4 up to 128×128 pixels, dozens of directional prediction modes, and filters that smooth block edges after decoding. Big smooth areas like sky or studio backdrops can be coded as a few large blocks, while edges get small ones. JPEG is locked to 8×8 blocks everywhere, which is why skies band and edges ring at low sizes.

The trade-off is time. AVIF encoders search many more options, so a large photo can take several seconds, noticeably longer than WebP or JPEG. For one hero image it doesn’t matter; for a thousand product photos, it adds up.

Size claims, honestly

Published comparisons (Google’s WebP study, Netflix’s AVIF work) report average savings, but your images will differ: noisy photos, screenshots and already-compressed files all behave differently. The only reliable number is the one you measure. Drop the same photo into the converter as WebP and as AVIF and compare the real byte counts and the side-by-side view.

Serving both safely

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

The browser takes the first source whose type it supports and ignores the rest, so every visitor gets a picture.

Questions

Is AVIF better than WebP?

For photos at the same visual quality AVIF is usually smaller, especially at low bitrates, but it is slower to encode and was supported by browsers later. WebP is the safer single choice; AVIF with a WebP or JPEG fallback gets the smallest files.

Is WebP better than JPG?

For websites, generally yes: Google’s own comparison measured lossy WebP 25–34% smaller than JPEG at equal SSIM. JPEG still wins on compatibility with older software, printers and strict upload forms.

What is the best image format for the web?

Photos: AVIF or WebP with a JPEG fallback. Graphics with transparency: WebP or PNG. Icons and logos: SVG where possible, otherwise PNG. Animations: video (MP4/WebM) rather than GIF.

What about JPEG XL?

JPEG XL compresses well and can losslessly repack existing JPEGs, but browser support is still limited, so it isn’t practical as a default web format yet.