1.17 Compress images
Quality 80 is usually indistinguishable and much smaller.
Compress your images / keep the image count low
Images are usually the heaviest thing on a page, which makes this the highest- value item on the list for most sites.
Most images on the web are compressed far too lightly, or not at all. A photograph exported at quality 100 is typically three times the size of the same image at quality 80, and the difference is invisible at normal viewing size.
Start at quality 75–85 for photographs and compare. Go lower for large background images where detail does not matter; higher only where you can actually see artifacts.
Automate it
Compressing by hand does not survive contact with a team. Someone will upload an unoptimized 4MB photo, and they should not have to think about it.
- Framework image components —
next/image,nuxt/image, Astro's<Image>— handle format, resizing and compression automatically. - A build step with sharp for static assets.
- An image CDN — Cloudinary, imgix, Cloudflare Images — transforming on request. Worth it when users upload images.
Squoosh is for finding the right setting by eye on one image, not for the pipeline.
Before you compress
Is it the right size? A 4000px image displayed at 400px wastes 99% of its pixels. Resize first — see responsive images.
Does it need to be an image? Gradients, shapes, shadows and rounded corners are cheaper in CSS. Text in an image is heavier and unreadable to screen readers and search engines.
Do you need it at all? The cheapest image is the one you removed. Decorative stock photography is often pure weight.