AVIF vs WebP: image optimisation for a lighter, greener site

If your site feels sluggish, images are the first place to look. On most sites they make up the biggest share of what visitors download, which means they also drive a large part of the site’s estimated emissions. Get images right and you’ve usually done the single most useful thing you can for both speed and carbon.

Two modern formats do most of the heavy lifting here: AVIF and WebP. Here’s how they compare, when to use each, and a simple workflow that keeps your pages light without making your photography look worse.

Key takeaways

  • AVIF generally produces smaller files than WebP at similar visual quality, but it takes longer to encode.
  • WebP has very broad browser support; AVIF support is good but worth checking for your audience.
  • Use the picture element to serve AVIF first, WebP second and a JPEG or PNG fallback.
  • Format is only part of the job: responsive sizes, lazy-loading and removing decorative images matter just as much.

Why image optimisation matters for a greener site

A website’s estimated emissions come from three places: the data centre serving the page, the network carrying the data, and the visitor’s device displaying it. The number of bytes transferred drives the network and device share. Fewer bytes means less work at every step.

Images are usually the biggest lever, ahead of JavaScript, third-party scripts, fonts, caching and hosting. They also tend to be the element that decides your Largest Contentful Paint, the Core Web Vital that measures how quickly the main content appears. So a lighter hero image helps your speed scores and your carbon estimate at the same time.

As a rough benchmark, a page under 500 KB is genuinely lean, while anything over 2 MB usually points to uncompressed images, a page builder and several third-party scripts.

AVIF and WebP at a glance

Both formats were designed to replace JPEG and PNG on the web, and both support lossy and lossless compression as well as transparency. The MDN guide to image file types is a solid reference if you want the technical detail behind each one.

Factor AVIF WebP
File size Generally smaller at similar visual quality Much smaller than JPEG; usually a little larger than AVIF
Encoding speed Slower, especially at high-effort settings Faster and easier to batch
Browser support Good in current browsers; check your audience Very broad
Best for Large photos, hero images, galleries A dependable default and fallback

When to choose AVIF

AVIF shines on big photographic images, where its stronger compression saves the most bytes. Hero banners, portfolio galleries and product photography are all good candidates. Because it can hold detail at smaller file sizes, you can often keep your images looking crisp while sending noticeably less data.

The trade-off is encoding time. If you export hundreds of images at once, AVIF can be slow to produce. That’s a one-off cost at build or upload time, though, not something your visitors pay for. Before you rely on it, take a look at current AVIF browser support and compare it with what your analytics say about your visitors.

When to choose WebP

WebP is the safe, sensible default. It’s widely supported, quick to encode and still a big improvement on JPEG and PNG. It’s also the natural fallback when a browser can’t display AVIF. For icons, simple graphics and smaller images, the difference between the two formats is often small, so WebP alone may be enough.

The answer is usually both

You don’t really have to pick a side. The HTML picture element lets the browser choose the best format it understands:

  • List the AVIF source first.
  • List the WebP source second.
  • Finish with a standard JPEG or PNG in the img tag as the fallback.

Visitors on current browsers get the smallest file; everyone else still sees the image.

A simple image optimisation workflow

Format is only one part of the picture. Work through these steps and you’ll cut far more weight than a format switch alone:

  1. Keep a high-quality master of every image, then export web versions from it.
  2. Export several sizes and use srcset and sizes so phones don’t download desktop-width photos.
  3. Compress to AVIF and WebP, checking quality by eye rather than trusting a default setting.
  4. Strip metadata such as camera details and location data.
  5. Lazy-load images below the fold, but not your main hero image.
  6. Drop purely decorative images that add weight without helping the visitor.
  7. Re-test the page in Google PageSpeed Insights and compare transfer size with your baseline.

Images are one piece of a wider approach. If you want to go further, these sustainable web design techniques cover JavaScript, fonts, third-party scripts and caching in the same practical way.

A note on claims

Once you’ve slimmed your images, it’s tempting to say your site is now “green”. Be careful with wording. Website carbon figures are modelled estimates, not measurements, so describe them as estimated and give the date. And lighter pages are a real reduction, which is a much better story than any offset.

Conclusion

AVIF usually gives you the smallest files; WebP gives you reliability and speed. Serve both through the picture element, size images properly, lazy-load what sits below the fold and remove anything decorative. Your pages will load faster, your visitors will download less, and your site’s estimated footprint will shrink without any loss in how your work looks.

About Blanche Street