الانتقال إلى المحتوى
FrontendWeb Performance· 6 دقائق للقراءة

Lazy-Loading Your Hero Image Makes LCP Worse

A lazy image waits for CSS and layout before it's even requested, and the hero can't afford that wait.

ReadIn

مقال كل يوم يفرق معاك

21 نوفمبر 2026
  • كاتب موثّق
محتويات المقال

A performance sprint adds loading="lazy" to every <img> through a shared image component. Image bytes drop, and the landing page's LCP gets worse. We rebuilt the page and loaded it in headless Chromium 156 on a 412px-wide viewport, with the network emulated at 150 ms latency and 1.6 Mbps through the DevTools protocol, and a stylesheet from a server that takes 600 ms to answer. Over five runs, the median LCP was 1.77 s with an eager hero and 2.42 s with a lazy one. The eager hero was requested at 0.19 s; the lazy one only at 1.13 s, right after the stylesheet finished.

The common misconception

The belief: lazy-loading every image, including the one at the top of the page, always makes the page faster.

It's a reasonable generalization of good advice. Lazy loading is one attribute, it saves real bytes, and web.dev itself recommends it for offscreen images. WordPress applied it by default, shared image components often do the same, and the savings show up right away in the network panel. If deferring images is good, deferring all of them sounds even better. The catch is that "lazy" isn't free for an image that's visible the moment the page appears.

What actually happens

Lazy means "wait for a condition"

The HTML Standard defines the lazy state of the loading attribute as deferring the fetch until some conditions are met, and eager, the default, as fetching immediately. In practice the condition is distance from the viewport: Chrome starts a lazy image once it's within 1,250px on fast connections or 2,500px on slower ones, so images arrive just before the user scrolls to them.

The browser can't measure distance before layout

To know how far an image is from the viewport, the browser needs its position, and that takes layout, which waits for render-blocking CSS. web.dev's LCP guide says it directly: with lazy loading, the resource won't load until after layout confirms the image is in the viewport.

An eager image doesn't wait. The browser's finds it in the HTML while the document is still arriving and requests it alongside the stylesheet. That's what our run showed: the eager hero downloaded during the 600 ms the stylesheet took, and the lazy hero started only once the stylesheet had arrived and layout had placed it. Chromium also requested the lazy hero at Low priority and raised it to High afterward.

Where the delay lands in LCP

web.dev splits into four parts: time to first byte, resource load delay, resource load duration and element render delay. Lazy loading inflates the second. The guide's rule of thumb is that the LCP resource should start loading at the same time as the first resource the page loads, and its warning is blunt: never lazy-load your LCP image, because it always adds unnecessary resource load delay.

The field data agrees. web.dev joined HTTP Archive pages with CrUX data: the median page without lazy loading had a 75th percentile LCP of 2,922 ms, against 3,546 ms for the median page with it. The authors stress that's a correlation, not proof of cause, but their lab test on WordPress found the same trade: fewer image bytes, later LCP.

Lazy loading still earns its place below the fold

The fix isn't to drop the attribute everywhere. In the same WordPress study, lazy-loading only below-the-fold images completely reversed the LCP regression, partly because those images no longer compete with the hero for the network. We saw that too: with loading="lazy" removed from four product images far down the page, they downloaded alongside the hero and LCP rose to 3.97 s, on a local HTTP/1.1 server.

fetchpriority is a hint for when images compete

The HTML Standard describes fetchpriority="high" as signaling a high-priority fetch relative to other resources of the same type. web.dev calls it a hint, not a directive, and reports LCP in a Google Flights test improving from 2.6 s to 1.9 s. On our page, with only one image competing, it made no measurable difference: it pays off when several images compete. Keep it to one or two images; web.dev notes that hinting more makes it unhelpful.

HTML index.html
<!-- Every image lazy, the hero included --><img src="/hero.jpg" alt="Summer sale: 30% off running shoes"     width="1600" height="900" loading="lazy"><img src="/p1.jpg" alt="Trail runner"     width="800" height="600" loading="lazy">

To catch a lazy LCP image on real pages, web.dev suggests a PerformanceObserver check. This one logged a warning in our run for the lazy version only:

JavaScript lcp-check.js
new PerformanceObserver((list) => {  const lcp = list.getEntries().at(-1);  if (lcp.element?.getAttribute("loading") === "lazy") {    console.warn("LCP image is lazy-loaded:", lcp.element);  }}).observe({ type: "largest-contentful-paint", buffered: true });
ImageloadingfetchpriorityWhy
The hero, likely the LCP elementDefault (eager)highFound by the preload scanner, requested with the first resources
Other images in the first viewportDefault (eager)DefaultVisible on arrival: web.dev says always eager-load them
Images below the foldlazyDefaultSaves bytes and keeps the network free for the hero
A hero set as a CSS backgroundNot applicablePreload itNot discoverable from the HTML unless preloaded

How to apply it in your project

  1. Find the LCP element per templateRun the observer above, or check the LCP element in the DevTools Performance panel, on mobile and desktop widths. The fold moves with the viewport, so the LCP image can differ between them.
  2. Make the hero eager and discoverableRemove loading="lazy" from it, keep its URL in a plain src or srcset in the server's HTML, and add fetchpriority="high".
  3. Make lazy the default below the fold onlyGive your image component an explicit prop such as priority for above-the-fold images, instead of one global default for every image.
  4. Measure the result in the fieldCompare the 75th percentile LCP before and after the change in your real-user data, not only in one lab run.

Key takeaways

  • loading="lazy" defers the fetch until layout shows the image is near the viewport, so it waits for CSS and layout.
  • Eager images are found by the preload scanner and requested while the HTML is still arriving.
  • Never lazy-load the LCP image: web.dev calls it unnecessary resource load delay.
  • Lazy-load images below the fold, where it saves bytes and reduces competition with the hero.
  • Use fetchpriority="high" on the hero, and keep the hint to one or two images.

📚 المصادر

  1. Optimize Largest Contentful Paint — web.dev
  2. The performance effects of too much lazy loading — web.dev
  3. Browser-level image lazy loading for the web — web.dev
  4. Optimize resource loading with the Fetch Priority API — web.dev
  5. HTML Standard: Lazy loading attributes — WHATWG

التعليقات (0)