Skip to content

The page's largest image waits to load

lcp-image-lazymoderate
On this page

Why it matters

  • Largest Contentful Paint (LCP) measures when the largest image or text block of the first screen appears; it is one of the Core Web Vitals.
  • web.dev says: "Never lazy-load your LCP image, as that will always lead to unnecessary resource load delay". With loading="lazy", the image is not fetched "until after layout confirms the image is in the viewport".
  • An image a script loads late is worse: its address is not in the HTML, so the browser cannot start early. web.dev calls this "never optimal".
  • Lazy loading is right for images further down the page; the first screen's main image is the one exception.

Example

Wrong
<img id="hero" src="/images/hero.svg" loading="lazy" width="360" height="270" alt="نقش سدو أحمر ورملي" />
Right
<img id="hero" src="/images/hero.svg" fetchpriority="high" width="360" height="270" alt="نقش سدو أحمر ورملي" />

How to fix

Load the first screen's main image at once, and give it priority:

html
<img id="hero" src="/images/hero.svg" fetchpriority="high" width="360" height="270" alt="نقش سدو أحمر ورملي" />
  • Remove loading="lazy", and the lazy-loading script's class and data-src, from this one image; keep them on the images below it.
  • In a store theme, the setting is often called "lazy load the first image" or similar.

How we detect

  1. We render the page at phone size and read the element of the largest contentful paint, as Chromium and Firefox report it (WebKit reports none).
  2. We report it when it is an <img> with loading="lazy", or any element with the marks of a lazy-loading script: data-src, data-srcset, data-lazy-src, or a lazyload or lazy class.
  3. The largest element can differ at another screen size; we judge the phone's.