Image Optimization for the Web: A Practical Guide
Formats, dimensions, compression and Core Web Vitals — everything you need to ship fast images, in one place.
Images are typically the largest part of a page's total weight — often 50–70%. That makes image optimization the highest-leverage performance work you can do: no backend changes, no refactors, just smaller files and faster pages. This guide covers the four decisions that matter: format, dimensions, compression and delivery.
1. Choose the right format
For the vast majority of web images, the answer in 2026 is WebP. It compresses photos and graphics 25–35% smaller than JPEG and PNG at the same visual quality, supports transparency, and is supported by over 97% of browsers.
| Format | Best for | Weakness |
|---|---|---|
| WebP | Photos, graphics, transparency — the web default | Very old browsers (pre-2020) |
| JPEG | Fallback for ancient browsers | Large files, no transparency |
| PNG | Pixel-perfect lossless source files | Very large files |
| SVG | Logos, icons, illustrations | Not for photos |
| AVIF | Maximum compression | Slower encoding, younger support |
Use our free converter to turn PNG to WebP or JPG to WebP directly in your browser.
2. Serve images at display size
A 4000px-wide photo displayed at 800px forces every visitor to download 25× more pixels than they see. Before compressing, resize the image to the largest size it will be displayed at:
- 1920px — full-screen heroes and backgrounds
- 1280px — blog and content images
- 800px — cards and sidebars
- 480px or less — thumbnails and avatars
If your layout is responsive, serve multiple sizes with srcset so phones download the small variant.
3. Compress with a quality target
Lossy compression is a trade-off: lower quality, smaller file. In practice:
- 75–85% — the sweet spot for most web images
- 90%+ — hero images and photography where detail matters
- 60–70% — thumbnails and images viewed at small sizes
Always compare the preview against the file size; the right setting is the lowest one you can't visually distinguish.
4. Lazy-load and use modern delivery
Add loading="lazy" to images below the fold so they only download when needed — but keep the LCP image eager. Use width and height attributes to prevent layout shift, and consider a CDN for high-traffic sites.
How images affect Core Web Vitals
Three Google metrics are directly influenced by images:
- Largest Contentful Paint (LCP) — measures when the largest visible element (usually an image) finishes loading. The target is under 2.5 seconds. Oversized images are the #1 cause of poor LCP.
- Cumulative Layout Shift (CLS) — images without declared dimensions push content around as they load. Always set width and height.
- Interaction to Next Paint (INP) — heavy pages with dozens of unoptimized images delay JavaScript responses.
Since 2021, Core Web Vitals have been a Google ranking signal. Image optimization is one of the few SEO improvements that is simultaneously good for rankings, good for users and cheap to implement.
Quick checklist
- Convert photos and graphics to WebP (JPG or PNG sources)
- Resize to display dimensions before compressing
- Use 75–85% quality for most images
- Add
loading="lazy"below the fold, keep the LCP image eager - Declare
widthandheighton every<img> - Serve multiple sizes with
srcsetfor responsive layouts
Optimize an image right now
Free, private and 100% client-side — crop, resize and convert to WebP in seconds.
Open the optimizer