Help and documentation
Speed Medium impact Easy 20–40 min
Modern image formats (WebP/AVIF)
WebP and AVIF are 25–50% smaller than JPEG/PNG.
What it is
WebP and AVIF are modern image formats with significantly better compression than JPEG/PNG at the same quality. All current browsers support them.
Why it matters
Images tend to be the largest part of a page's weight. Switching to WebP/AVIF saves tens of percent of data with no visible quality loss, a direct speed-up.
How to do it
- 1Convert images to WebP (universal) or AVIF (even smaller).
- 2Use <picture> with a fallback to be safe.
- 3Automate conversion in the build / via a CDN with image transformation.
- 4At the same time, resize to the dimensions actually needed.
Example
Correct
<picture>
<source srcset="photo.avif" type="image/avif">
<source srcset="photo.webp" type="image/webp">
<img src="photo.jpg" alt="..." width="800" height="600">
</picture>Conclusion
Modern formats are one of the most effective ways to reduce page weight. Ideally automate the conversion so it's not manual work for every image. Combine with compression, correct dimensions, and lazy loading.
Related topics