Why it matters
- AVIF and WebP are newer than JPEG and PNG, and store the same image in far fewer bytes.
- Every current browser shows them: Chrome, Firefox, Safari and Edge.
- And images are often the heaviest part of a page, so making them smaller is one of the quickest ways to speed it up.
Example
<img src="/images/sadu.png" width="128" height="128" alt="نقش سدو أحمر ورملي" />
<img src="/images/sadu.webp" width="128" height="128" alt="نقش سدو أحمر ورملي" />
How to fix
Convert images to AVIF or WebP, with a tool such as Squoosh or your content delivery network's image service, and serve them with <picture> and a fallback for older browsers:
html
<picture>
<source srcset="sadu.avif" type="image/avif" />
<source srcset="sadu.webp" type="image/webp" />
<img src="sadu.jpg" width="128" height="128" alt="Sadu pattern" />
</picture>- Icons and simple drawings suit SVG.
How we detect
- We render the page and read the images the browser drew, with each file's format, size and dimensions in pixels (the file's own, not the size it is drawn at).
- For an image in JPEG, PNG or BMP, we estimate its size as AVIF from its pixels: 2 bytes per pixel, compressed 12 to 1. Lighthouse 12 re-encoded each image in Chrome and estimated AVIF from those sizes, and used this estimate only for an image it could not re-encode; we use it for every image, in every engine. GIF is left out, as Lighthouse 12 left it out.
- The rule fails when the file is larger than that estimate by 8,192 bytes or more: Lighthouse 12's own limit.
- We report each image once, at the first element that shows it.