Serve Images in Next-Gen Formats
Updated
Up to Lighthouse 12, PageSpeed Insights asked you to serve images in next-gen formats; Lighthouse 13 reports the same issue as a reason inside Improve image delivery. Either way, it has found JPEG, PNG or GIF files that would be noticeably smaller as WebP or AVIF at the same visual quality. Both newer codecs compress far more efficiently than JPEG (1992) and PNG (1996). Images are usually the heaviest part of a page, so switching formats cuts many bytes without visible quality loss.
From PerfDelta's measurements: Lighthouse reports this finding on 57% of 41,409 measured home pages. The median saving is 2407 ms (PerfDelta estimate from the bytes that can be saved, at 1.6 Mbit/s). More in the data section below.
Improve image delivery: the Lighthouse 13 insight
In Lighthouse 13, and so in PageSpeed Insights, next-gen formats are part of the insight Improve image delivery. It replaces four earlier audits: "Serve images in next-gen formats", "Efficiently encode images", "Properly size images" and "Use video formats for animated content" (Lighthouse source code, replacesAudits in core/audits/insights, version 13.5, retrieved 17 October 2026). The insight lists each image with the reason for the saving, so a modern-format row is the case this guide covers; oversized images are covered in Properly size images, and the insight as a whole, with compression and animated GIFs, in Improve image delivery.
WebP and AVIF: two modern formats for different jobs
WebP and AVIF both support lossy and lossless compression, transparency and animation, so either one can replace JPEG, PNG and animated GIF. They differ in where they perform best:
- Photos: AVIF usually produces the smallest file for photographic content, especially at lower quality settings where JPEG shows blocky artifacts. WebP is a solid second choice and encodes much faster.
- Graphics and screenshots: flat colours, text and sharp edges often compress well as lossless WebP. For logos and icons, SVG is usually better than any raster format.
- Transparency: both formats keep an alpha channel, so a transparent PNG can become a lossy WebP or AVIF with transparency intact. Converting it to JPEG would lose the transparency.
- Animation: animated WebP and AVIF are far lighter than GIF. Longer clips are often lighter as a muted
<video>.
All current major browsers support both formats. Older devices and non-browser clients such as email programs may not, which is why a fallback stays part of every setup below. JPEG XL is a third candidate, but support is still incomplete: Chrome from version 155 and Firefox from version 158 decode it, Safari only partially and Edge not at all (caniuse, JPEG XL, retrieved November 2026). For now it is at most an additional <source> in front of AVIF, not a replacement for WebP or AVIF.
Why the modern-image-formats audit appears
Up to Lighthouse 12, the audit (ID modern-image-formats) estimated how large each JPEG, PNG or GIF on the page would be in a modern format and flagged every image where the saving exceeded a small threshold, together with the estimated savings per file. Lighthouse 13, and with it PageSpeed Insights, runs this check inside the "Improve image delivery" insight alongside image sizing and compression. Affected files appear there with the reason "Using a modern image format (WebP, AVIF) or increasing the image compression could improve this image's download size". The insight only lists a reason if it saves more than 4 KiB, and animated GIFs get a separate reason that recommends video (Chrome for Developers, Improve image delivery).
The fix matters most when the flagged image is the Largest Contentful Paint element. A smaller file finishes downloading sooner, which helps you reach the 2.5 second threshold for a good Largest Contentful Paint. Elsewhere on the page, fewer bytes still reduce total page weight. Format is a separate lever from properly sizing images: format changes the compression, dimensions change how many pixels you ship, and most images benefit from both.
How to serve images in next-gen formats
1. Convert images with a browser tool, cwebp, avifenc or sharp
For single images, the WebP converter and the AVIF converter convert JPG and PNG in the browser without uploading them; Squoosh, another browser app, compares formats and quality settings for one image at a time. For batches in a build or on a server, use the command-line encoders from the WebP and libavif projects:
# WebP at quality 80
cwebp -q 80 photo.jpg -o photo.webp
# AVIF at quality 60, speed 6 (lower speed = smaller file, slower encode)
avifenc -q 60 -s 6 photo.jpg photo.avif
In a Node.js build step, the sharp library produces both variants from one source file:
const sharp = require('sharp');
await sharp('src/hero.jpg').webp({ quality: 80 }).toFile('dist/hero.webp');
await sharp('src/hero.jpg').avif({ quality: 55 }).toFile('dist/hero.avif');
Always convert from the highest-quality original you have, not from a JPEG that was already compressed for the web. Build conversion into your pipeline so new uploads are covered.
2. Serve modern formats with the picture element and a fallback
The <picture> element lets the browser pick the first format it supports, with the original as a safety net:
<picture>
<source srcset="/hero.avif" type="image/avif">
<source srcset="/hero.webp" type="image/webp">
<img src="/hero.jpg" width="1200" height="800" alt="Product hero image">
</picture>
The browser checks each <source> in order and falls back to the plain <img> if none match, with no JavaScript and no user-agent sniffing. Keep width, height and alt on the <img>. Each <source> can also take srcset and sizes to combine formats with responsive widths.
3. Use content negotiation at the CDN or server
Browsers announce the formats they accept in the Accept request header, for example Accept: image/avif,image/webp,*/*. An image CDN can read that header and return AVIF, WebP or the original from a single URL, so your HTML keeps a plain <img src="/hero.jpg">. Most image CDNs offer this as an automatic format option, for example f_auto at Cloudinary or auto=format at imgix.
If you negotiate formats yourself, the response must include Vary: Accept. Without it, a shared cache may store the AVIF response and hand it to a client that cannot decode it. A typical nginx setup serves a pre-generated .webp file next to the original:
map $http_accept $webp_suffix {
default "";
"~*webp" ".webp";
}
location ~* \.(jpe?g|png)$ {
add_header Vary Accept;
try_files $uri$webp_suffix $uri =404;
}
This expects files named like photo.jpg.webp. Note that add_header inside a location replaces all add_header directives inherited from the server block, so repeat security headers there or set Vary at server level. Make sure your CDN respects Vary: Accept and purge its cache after switching.
4. Choose quality settings per image type
The format only saves bytes if the quality setting fits. For lossy WebP, a quality between 75 and 82 is a common starting point. AVIF uses a different scale and usually looks clean at lower values, so start around 50 to 60 and adjust. Compare results at real display size. Reserve lossless mode for screenshots with small text.
WordPress, Shopify and Next.js settings for next-gen images
WordPress
WordPress accepts WebP uploads since version 5.8 and AVIF uploads since version 6.5, provided the server's image library (Imagick or GD) supports the format. Core does not convert your JPEG uploads to a modern format by default. The "Modern Image Formats" plugin from the WordPress Performance Team generates WebP or AVIF versions of uploaded images, as do many image optimisation plugins. After enabling conversion, regenerate existing media so older uploads are covered too.
Shopify
Shopify's CDN automatically serves a modern format such as WebP to browsers that support it, as long as the theme loads images through the CDN, for example with the image_url filter:
{{ product.featured_image | image_url: width: 800 | image_tag }}
Images still flagged on a Shopify store usually bypass the CDN, for example hard-coded URLs or third-party apps.
Next.js
The next/image component converts and serves images through the built-in optimiser. WebP is the default. To serve AVIF first, add it to the formats list:
// next.config.js
module.exports = {
images: {
formats: ['image/avif', 'image/webp'],
},
};
The optimiser picks the first format from this list that the browser's Accept header allows. AVIF encodes slower, so each first request takes longer until cached. Plain <img> tags and CSS backgrounds bypass it.
Common mistakes when converting to WebP and AVIF
- Re-encoding compressed JPEGs at high quality: converting a heavily compressed JPEG to WebP at quality 90 can produce a larger file with the old artifacts baked in. Convert from the original master and check that the new file is actually smaller.
- Removing the fallback for email and social images: some email clients do not display WebP or AVIF, and link previews on social platforms are more reliable with JPEG or PNG. Keep a JPEG or PNG for newsletters and your
og:image. - Rasterising logos and icons: a logo exported as WebP is still a raster image. SVG is usually smaller and stays sharp at every size.
- Lazy loading the LCP image: a modern hero image that loads late still delays Largest Contentful Paint. Only defer offscreen images.
- Missing
Vary: Accept: with server-side negotiation, caches can serve the wrong format to the wrong client.
How to verify the fix
Re-run PageSpeed Insights or Lighthouse and confirm that "Improve image delivery" lists fewer rows with the modern-format reason, ideally none. In Chrome DevTools, open the Network panel, filter by "Img" and check the Type column, or the Content-Type response header, for avif or webp. With negotiation, confirm Vary: Accept is present. Test a second browser for the fallback path and check category and product templates, which usually hold most images.
PerfDelta tests several pages on mobile and desktop and lists the Lighthouse opportunities with estimated savings and the affected image files, so you can see which templates still ship JPEG or PNG. If images remain after a fix, purge the CDN or plugin cache.
Frequently asked questions
What does "serve images in next-gen formats" mean?
It was a Lighthouse audit up to version 12 that flagged JPEG, PNG and GIF images that would be noticeably smaller as WebP or AVIF at the same visual quality. In Lighthouse 13 the same check is a reason within Improve image delivery, which lists each file with its estimated savings.
Should I use WebP or AVIF?
AVIF usually gives the smallest files for photos but encodes more slowly. WebP encodes fast and compresses well. Serving AVIF first with a WebP source and a JPEG or PNG fallback gives each visitor the smallest file their browser can read.
Do I still need a JPEG or PNG fallback?
Yes, for older devices and non-browser clients. The picture element or a CDN with content negotiation handles this automatically. Keep JPEG or PNG for email newsletters and Open Graph images, where modern formats are not reliably displayed.
How do I serve next-gen images in WordPress?
WordPress accepts WebP and AVIF uploads but does not convert existing JPEGs by default. Use the Modern Image Formats plugin or an image optimisation plugin to generate WebP or AVIF versions, then regenerate existing media.
Does Shopify serve WebP automatically?
Yes. Shopify's CDN serves a modern format such as WebP to supporting browsers when images load through the CDN, for example with the image_url filter. Images from other hosts or hard-coded URLs are not converted.
Why does the audit still appear after I converted my images?
Common causes are a cache still serving the old files, images outside your pipeline such as CSS backgrounds or third-party embeds, and markup that still points to the original JPEG or PNG. Purge the cache and check the Type column in the DevTools Network panel.
What PerfDelta's measurements show
Lighthouse reports this finding on 57% of 41,409 measured home pages. The median saving is 2407 ms (PerfDelta estimate from the bytes that can be saved, at 1.6 Mbit/s).
Data as of November 30, 2026, recalculated daily. Source: PerfDelta's own measurements (Chrome UX Report and Lighthouse); details in the website speed statistics and the methodology.
Thresholds and sources
Sources:
- Chrome for Developers: Improve image delivery insight
- Lighthouse: Serve images in next-gen formats (until Lighthouse 12)
- Google for Developers: WebP
All sources retrieved on November 16, 2026. Thresholds and documentation change; the linked page is authoritative.
Test your site
Run a free scan to see whether this applies to your pages, on mobile and desktop, with lab and field data side by side.
Run a free testA free account saves your tests and shows how your values change from one test to the next. Website performance monitoring with field data and alerts starts with the Solo plan.