Skip to content

Guides

AVIF vs WebP: which image format should your website use?

ComparisonsUpdated 29 October 20263 min read

Short answer: both are much smaller than JPG. AVIF usually gives the smallest files at the same visual quality, especially for photos, but it's slower to create. WebP is quicker to make and works everywhere. A safe setup is AVIF first, WebP as a fallback and JPG as the last resort, all in one <picture> element.

Side by side

AVIFWebP
Typical size vs JPGOften around halfOften 25–35% smaller
Best atPhotos, gradients, low bitratesPhotos and graphics, all-round
TransparencyYesYes
AnimationYesYes
HDR and wide colourYesNo
Browser supportAll current major browsers (Safari since 16.4)All current major browsers
Encoding speedSlowFast
Editing supportGrowing, still patchy in older appsWide

The size figures are typical, not guaranteed. Results depend on the image and the quality setting.

When to choose AVIF

When to choose WebP

The fallback setup

Serve AVIF to browsers that support it, and WebP or JPG to the rest:

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

Always include width and height so the page doesn't jump while images load. That jump hurts your Cumulative Layout Shift score. Use loading="lazy" for images below the fold, but not for the main image at the top.

How to make AVIF and WebP files

  1. Resize the original to the largest size it's shown at with the image resizer.
  2. Convert with JPG to AVIF and JPG to WebP, or the image converter for other formats.
  3. For several sizes plus the HTML, use the SEO image pack. It makes WebP and AVIF sizes and a ready srcset snippet.

To go the other way, use AVIF to JPG or WebP to JPG when an app won't open a file.

Questions

Is AVIF always smaller than WebP?

No. For most photos it is, but for some simple graphics and tiny images WebP can be the same size or smaller. Test with your own images.

Should I still keep JPG files?

Keep the originals, and serve JPG as the last fallback in <picture>. Some email clients and older tools still need JPG.

Does Google prefer AVIF or WebP?

Search engines index both. What helps is a faster page. Smaller images improve Core Web Vitals, whichever modern format you use.

What about PNG?

Use PNG for screenshots, logos with sharp edges and anything that must stay pixel-perfect. Use SVG for icons and simple logos. See WebP vs JPG vs PNG.