Image formats and srcset: faster LCP without blurry photos
Serving a 3000 pixel photo to a phone slows LCP. Here is how WebP, AVIF, srcset, and sizes cut image bytes, and the mistakes that blur or break images.
On many pages, the largest element on screen is an image. That makes image weight one of the most common causes of a slow Largest Contentful Paint. The fix is rarely exotic. Send the right file format at the right size, and the browser does the rest.
This guide covers file formats, responsive images with srcset and sizes, and the markup mistakes that undo the gains. It does not repeat alt text advice or lazy loading rules, which have their own guides.
Why image bytes matter for search
Google uses Core Web Vitals as part of its page experience signals. LCP is one of them, and Google's published guidance rates 2.5 seconds or less as good. A hero photo that takes three seconds to download can fail that on its own.
Weight also affects crawlers. Googlebot and other fetchers have limits on how much they will pull, and heavy pages cost more to fetch at scale. Fast pages are cheaper for everyone. The ranking effect of speed alone is modest, so treat this as a user experience win first.
Choosing a format
You have four realistic choices for web photos and graphics. Each fits a different job.
- JPEG: the old default. Works everywhere, but files are larger than newer formats at the same quality.
- WebP: supported by all major current browsers. Usually noticeably smaller than JPEG, and handles transparency.
- AVIF: often smaller again than WebP, also widely supported now. Encoding is slower, so build it into your pipeline rather than doing it by hand.
- SVG: best for logos and icons. It scales without loss and is usually tiny.
Google Images can index JPEG, PNG, WebP, AVIF, SVG, GIF, and BMP files. Switching to WebP or AVIF does not cost you image search visibility. Savings vary by image, so test your own files instead of trusting a headline percentage.
Newer formats exist, and some have patchy browser support. Check current support before you depend on one. A safe approach is to always keep a JPEG or PNG fallback.
Responsive images with srcset and sizes
Format is only half the story. A phone with a 400 pixel wide layout does not need a 2400 pixel wide file. The srcset attribute lists several widths of the same image. The sizes attribute tells the browser how wide the image will display. The browser then picks the best file.
- Export each image at several widths, for example 480, 800, 1200, and 1600 pixels.
- List them in srcset with width descriptors, such as photo-800.webp 800w.
- Set sizes to match your real layout, for example full width on mobile and half width on desktop.
- Keep a plain src attribute pointing at a mid-size file as the fallback.
To offer more than one format, wrap the image in a picture element. Put an AVIF source first, a WebP source second, and a standard img tag last. The browser takes the first source it supports.
The sizes mistake
If you leave sizes out, the browser assumes the image fills the full viewport width. On a wide screen it then downloads a large file for an image that shows at a third of that. Many sites ship srcset and still lose the benefit for this reason.
Markup mistakes that undo the gains
- Missing width and height attributes. The browser cannot reserve space, so the page shifts when the image loads. That hurts CLS.
- Lazy loading the hero image. The LCP image should load right away. Save lazy loading for images below the fold.
- Compressing too hard. Smaller is not better if faces and text turn to mush. Check a few images at full size.
- Upscaling small originals. A blurry source stays blurry in any format.
- Images set only as CSS backgrounds. Crawlers and AI tools treat them as decoration, and the browser finds them later. Use a real img tag for content images.
If your hero image still loads late after you fix the file, look at resource hints. A preload or fetchpriority setting can move it earlier in the queue. That topic is covered in the guide on resource hints for LCP.
How to check your work
Open Chrome DevTools, go to the Network tab, and filter by Img. Sort by size. The biggest files are your first targets. Then run PageSpeed Insights and read the field data for LCP, since lab scores can differ from what real visitors see.
Lighthouse also flags images that are larger than their display size and images that could use a modern format. Treat those as a to-do list, not a score to chase.
What to do this week
- Find your five heaviest images in DevTools.
- Convert them to WebP or AVIF, with a JPEG fallback.
- Add srcset and a correct sizes attribute.
- Set width and height on every image.
- Make sure the hero image is not lazy loaded.
- Recheck LCP in PageSpeed Insights after a few weeks of field data.