How to optimize images for website speed
Lighter images = faster pages and better Core Web Vitals (LCP).
Why images decide your page speed
Images are usually the heaviest thing on a page and the most common cause of a slow Largest Contentful Paint (LCP). Getting them right is the single biggest speed win for most sites — more than any script or caching tweak.
The four steps
- Size to the slot. Never ship a 4000 px image into a 800 px container. Resize to roughly the displayed size (×2 for retina) with reduce image size.
- Use WebP. WebP is typically 25–35% smaller than JPEG at the same quality. Convert or compress WebP; keep a JPEG fallback for very old browsers.
- Compress. Quality 70–80 is usually indistinguishable from the original for photos. Compress image or compress JPG.
- Lazy-load below the fold and set explicit width/height so images don't cause layout shift (CLS).
Format cheat-sheet
- Photos: WebP (or JPEG).
- Logos, icons, screenshots, transparency: PNG, or WebP.
- Simple vector art: SVG.
See JPG vs PNG for choosing between the raster formats.
Frequently asked questions
What image format is fastest for websites?
WebP for photographs and most graphics — it is usually 25–35% smaller than JPEG/PNG at the same quality. Use SVG for simple vector art.
What quality should I compress website images to?
Around 70–80 for photos is typically indistinguishable from the original while being far smaller. Check a few images at your chosen setting before applying it everywhere.