Lazy Loading Without Wrecking Your Largest Contentful Paint
A developer runs an audit, sees “defer offscreen images,” adds loading="lazy" to every <img> in the template, and ships. Total bytes go down. Requests go down. And Largest Contentful Paint gets worse — sometimes by a lot.
This happens constantly, and it happens because the advice is right about ninety percent of your images and catastrophically wrong about the one that matters most.
The rule that the whole post rests on
Never lazy-load your LCP image. Lazy-loading the hero delays the exact paint that LCP measures.
Here’s the mechanism. The browser’s preload scanner reads ahead through your HTML while the parser is still busy, spots image URLs, and starts fetching them early — before layout, before CSS is done, before the element exists. That head start is a large part of why images appear as fast as they do.
When you write loading="lazy", you explicitly opt out of that. The browser now has to wait until it knows where the element sits relative to the viewport, which means waiting on layout, which means waiting on CSS. Only then does the request go out. For an image at the bottom of the page, that delay is free — the user isn’t looking at it. For your hero, you’ve just inserted layout into the critical path of your headline visual.
The result: an image that could have started downloading almost immediately instead starts hundreds of milliseconds later. LCP is measured when that element finishes rendering. You moved the start line backward.
What the hero should actually look like
<img src="hero-1600.jpg"
srcset="hero-800.jpg 800w, hero-1600.jpg 1600w"
sizes="100vw"
width="1600" height="900"
fetchpriority="high"
alt="...">
Three things are doing work here:
- No
loadingattribute at all. The default iseager. Don’t writeloading="eager"to be explicit unless it helps your team — it’s the same behavior, and some people add it and then forget which images they’ve marked. fetchpriority="high"tells the browser this image outranks the other images and low-priority resources it discovered at the same time. Images are fetched at low priority by default until layout proves they’re in the viewport; this attribute skips that negotiation.widthandheightreserve the space, protecting Cumulative Layout Shift. Aspect-ratio-preserving CSS still needs these attributes to work from.
The CSS background trap
If your hero is a CSS background-image, the preload scanner cannot see it at all — the URL lives in a stylesheet the browser must download and parse first. That’s a guaranteed late start. Either use a real <img>, or add <link rel="preload" as="image"> in the head. A real <img> is almost always the better answer; it also gives you alt text and responsive srcset.
Where lazy-loading genuinely earns its keep
Everything below the fold. Long-form article bodies with a dozen inline photos. Comment avatars. Related-post thumbnails. Footer logos. Anything in a tab or accordion that’s closed on load. On a long page these are the majority of your image weight and lazy-loading them is straightforwardly good — less bandwidth, less contention for the connection your hero is trying to use.
One caveat: browsers start fetching lazy images somewhat before they scroll into view. That’s intentional and usually invisible. But on fast scroll you can still catch a blank frame, so keep dimensions set and consider a cheap placeholder color.
The part people get wrong: identifying the LCP element
Don’t assume the hero photo is the LCP element. It often isn’t. LCP can be a headline block, a background-less text paragraph, a poster frame, or a logo — whichever is the largest contentful element painted in the initial viewport. On text-heavy templates it’s frequently an <h1>, in which case your image tuning won’t move the metric at all.
Find out before you optimize. In Chrome DevTools, the Performance panel marks the LCP node directly. Or use PerformanceObserver in the console:
new PerformanceObserver((l) => {
const e = l.getEntries().at(-1);
console.log(e.element, e.startTime);
}).observe({type: 'largest-contentful-paint', buffered: true});
Check it on mobile viewport and on a throttled connection, not just your desktop. The LCP element can differ between breakpoints — a hero that dominates on desktop may fall below the fold on a phone, at which point lazy-loading it becomes correct.
A short checklist worth running
- Identify the real LCP element per breakpoint.
- If it’s an image: eager,
fetchpriority="high", dimensions set, served from the same origin or a preconnected one. - Lazy-load everything reliably below the fold — and nothing above it.
- Re-measure on field data, not just lab runs.
Format choice and compression matter too, and they compound with this: a smaller hero downloads faster no matter how well you’ve prioritized it. Both halves are covered across our image SEO writing, and the sizing habits that feed into it start with what you pick when finding and using images in the first place.