How much do images affect Core Web Vitals?
Images are the single biggest contributor to LCP (Largest Contentful Paint) on most pages — typically 60–80% of the LCP element is an image. They also drive page weight, which affects INP indirectly through main-thread parsing work. Compressing the hero image alone often shifts LCP by 500–1500 ms.
What's the best image format for web performance in 2026?
AVIF for photos when you control the encode (30–50% smaller than JPEG at equivalent quality). WebP as the fallback (supported everywhere modern, 25–35% smaller than JPEG). JPEG as the universal fallback. Use <picture> with srcset to serve the best format each browser can decode.
What file size targets should I aim for?
Hero/LCP image: ≤100 KB. Above-the-fold content images: ≤80 KB. Thumbnails and avatars: ≤20 KB. Open Graph share images: ≤300 KB. These targets keep most pages under the 1.5 MB total page-weight budget recommended for good LCP on 4G.
Should I use lazy loading?
Yes for below-the-fold images (loading="lazy"). No for the LCP element — lazy loading the hero image actively hurts LCP because the browser delays the request. Mark the LCP image with fetchpriority="high" instead.
Does AVIF really beat WebP?
For photos, yes — typically 20–30% smaller at the same SSIM score. For graphics with sharp edges (logos, screenshots), WebP often matches or beats AVIF and decodes faster. Test both per asset class; don't blindly convert everything to AVIF.
What about JPEG XL?
JPEG XL offers excellent compression and progressive decoding but browser support remains limited (Safari yes, Chrome no as of 2026). Ship it as a progressive enhancement via <picture>, but keep AVIF/WebP as your primary modern format.
Can I automate compression in my build pipeline?
Yes. Tools like @fileslim/compress (JS), sharp (Node), squoosh-cli, or imagemin can compress on build. Run them in CI so your bundle never ships an uncompressed asset. For dynamic uploads, run compression in the browser before upload to save bandwidth.
Does a CDN make compression unnecessary?
No. A CDN with image optimization (Cloudflare Polish, Fastly IO, Cloudinary) helps but doesn't replace shipping well-optimized source assets. CDN-side optimization adds latency on first request and costs money at scale. Pre-compress at build time, let the CDN handle just format negotiation.