FileCompressorPrivate, in-browser compression

Fixing the 'Serve Images in Next-Gen Formats' Lighthouse Audit Error

Updated 23 Nov 2026

To fix the "Serve images in next-gen formats" Lighthouse audit error, you need to convert your legacy JPEG and PNG images into modern formats like WebP or AVIF, which provide superior compression without sacrificing visual quality. Modern image formats use advanced encoding techniques that drastically reduce file sizes, allowing pages to load significantly faster for visitors on all devices.

Website performance directly impacts user experience and search engine rankings. When Google's Lighthouse auditing tool flags your site for using older image formats, it means you are sending more data over the wire than necessary. Addressing this issue is one of the most reliable ways to improve your Core Web Vitals, specifically Largest Contentful Paint (LCP).

Understanding Next-Gen Image Formats

Traditional image formats like JPEG and PNG have been the backbone of the web for decades, but they have reached their technical limits. Newer formats were built from the ground up to handle the demands of modern media.

WebP

Developed by Google, WebP supports both lossy and lossless compression, as well as transparency (alpha channel). On average, a lossy WebP image is 25% to 34% smaller than a comparable JPEG image. Lossless WebP files are roughly 26% smaller than PNGs. Browser support for WebP is virtually universal today, making it a safe choice for almost every project.

AVIF

AVIF (AV1 Image File Format) is an even newer standard based on the AV1 video codec. AVIF offers even greater compression efficiency than WebP, often shrinking files by 50% or more compared to JPEG while retaining remarkable visual fidelity. While browser support is broad, you should check your specific audience demographics before making AVIF your sole format.

How to Convert and Compress Your Images Safely

When optimizing images for the web, privacy and data security are often top concerns, especially when dealing with proprietary graphics or client assets. You do not need to install bulky software or upload your sensitive files to a remote server. You can use the Compress Image for Website tool to process your files securely.

Because the processing happens entirely within your web browser, your files never leave your device. This client-side approach ensures total privacy while giving you the speed and compression power needed to clear the Lighthouse audit.

Step-by-Step Guide to Fixing the Audit

  1. Audit Your Current Site: Run a Lighthouse report in your browser's developer tools to identify which specific images are triggering the warning.
  2. Gather Your Original Assets: Locate the high-resolution source files of the flagged images on your local computer.
  3. Choose Your Target Format: Decide between WebP for maximum compatibility or AVIF for maximum compression.
  4. Process the Files Locally: Drag and drop your images into the browser-based converter tool to transform them into the desired next-gen format.
  5. Replace Images on Your Site: Upload the new files to your website and update your HTML or content management system to point to the new extensions.
  6. Verify the Fix: Clear your site cache and run the Lighthouse audit again to confirm the error has been resolved.

Traditional vs. Next-Gen Image Formats

Feature JPEG PNG-24 WebP AVIF
Compression Good (Lossy) Poor (Lossless) Excellent (Both) Superior (Both)
Transparency No Yes Yes Yes
Browser Support Universal Universal Near Universal Broad
Lighthouse Status Flagged Flagged Passed Passed

Implementation Strategies in HTML

Once you have your next-gen images ready, you need to serve them correctly to your users. There are two primary methods for delivering WebP or AVIF images: the HTML <picture> element and server-side content negotiation.

Using the Picture Element

The <picture> element allows you to provide multiple fallback sources so that older browsers still receive a standard JPEG or PNG, while modern browsers get the optimized next-gen version.

<picture>
  <source srcset="image.avif" type="image/avif">
  <source srcset="image.webp" type="image/webp">
  <img src="image.jpg" alt="Description of image" loading="lazy">
</picture>

This method is foolproof, highly compatible, and guarantees that Lighthouse will pass your pages without breaking functionality for users on older browsers or legacy devices.

Server-Side Content Negotiation

Advanced webmasters can configure their web server (such as Nginx or Apache) to inspect the Accept header sent by the visitor's browser. If the browser declares support for image/webp, the server automatically serves the WebP file while keeping the original file extension in the URL.

Common Mistakes and Fixes

Optimizing images can sometimes introduce subtle bugs if not done carefully. Here are common pitfalls and how to avoid them:

  • Forgetting Fallbacks: If you replace all image tags directly with WebP files without a fallback plan, users on ancient browsers may see broken images. Always use the <picture> element or verify your audience supports the format.
  • Over-Compressing: Crushing the quality setting too low creates visible artifacts and pixelation. Always visually inspect your compressed images before publishing.
  • Ignoring Dimensions: Converting a 4000-pixel wide image to WebP is not enough if it only displays at 400 pixels wide. Always resize your images to their maximum display dimensions before conversion.
  • Caching Issues: If you replace images but do not clear your Content Delivery Network (CDN) or browser cache, you might still see the old images and failing audit scores.

Quick Checklist for Next-Gen Image Optimization

  • Identify failing images via Lighthouse audit.
  • Resize images to match exact display dimensions.
  • Convert files to WebP or AVIF locally for complete privacy.
  • Implement <picture> tags or server rules for fallback support.
  • Test page layout and re-run Lighthouse to confirm a passing score.

Addressing the next-gen image audit is a straightforward process that yields immediate dividends in site speed, user engagement, and search engine visibility. By handling conversions locally and implementing proper HTML fallbacks, you ensure a fast and secure experience for every visitor.

Frequently asked questions

What does 'Serve images in next-gen formats' mean?

This Lighthouse audit error means your website is using older image formats like JPEG or PNG instead of modern compressed formats like WebP or AVIF. Modern formats offer much smaller file sizes without sacrificing visual quality, helping pages load faster.

Is WebP supported by all web browsers?

Yes, WebP has near-universal support across all modern web browsers, including Chrome, Safari, Firefox, and Edge. You can safely use WebP on almost any website today without worrying about compatibility issues.

Why should I use a browser-based image converter?

Using a browser-based tool processes your files directly on your device rather than uploading them to a remote server. This guarantees absolute data privacy and security, as your sensitive images never leave your computer.

Will converting my images break my website layout?

Converting images will not break your layout as long as you maintain the same aspect ratios and use proper HTML markup. For maximum safety, use the HTML picture element to provide fallbacks for older browsers.

How much smaller are WebP and AVIF files compared to JPEG?

WebP files are typically 25% to 34% smaller than comparable JPEGs, while AVIF files can achieve even greater reductions of 50% or more. These reductions directly translate to faster loading times and improved performance scores.

Related articles

Free tools