Glossary

Lazy loading

Lazy loading defers fetching a resource until it is about to be needed, typically when it approaches the viewport. For images and iframes it is a one-word attribute — `loading="lazy"` — implemented natively by every current browser. It reduces the bytes and requests of the initial load, which helps every loading metric, with one important exception: applying it to the image that is visible immediately delays exactly the thing being measured.

How the native attribute works

`<img loading="lazy">` and `<iframe loading="lazy">` tell the browser to defer the fetch until the element is near the viewport.

The browser decides how near, using a margin that varies with connection speed — it begins fetching earlier on slow connections so the resource arrives in time.

`loading="eager"` is the default and forces an immediate fetch.

Because it is native, it needs no JavaScript, works with the browser's own priority logic, and continues to work when scripts fail.

Why it must not be applied above the fold

An image visible on load is needed immediately. Marking it lazy delays its discovery and fetch until layout has determined it is in the viewport, which is later than the parser would have found it.

When that image is the Largest Contentful Paint element, the delay goes directly into the metric, and the result is a page that scores worse than before the optimisation.

Lighthouse reports this specifically, because applying `loading="lazy"` to every image with a global find and replace is such a common mistake.

The correct pattern is eager for what is visible on load, lazy for everything below, and `fetchpriority="high"` on the hero image.

What else can be deferred

Iframes, particularly video embeds, which are among the heaviest things a page can contain. A facade — a static thumbnail replaced by the real embed on click — is heavier engineering and a larger saving.

JavaScript modules, loaded dynamically when a feature is first used rather than in the initial bundle.

Long lists, through virtualisation, which is lazy loading applied to DOM elements rather than to files.

Web fonts, indirectly, through a display strategy that renders text in a fallback rather than waiting.

Background images set in CSS, which are not covered by the loading attribute and are deferred instead by the browser's own rule that a background is fetched only when an element using it is rendered.

How to check it

Inspect the images and confirm the attribute is present below the fold and absent above it.

In the network panel, scrolling should trigger new image requests. If everything is fetched on load, the attribute is missing or being overridden.

Check that lazy images still have `width` and `height`, since a deferred image without reserved space is a guaranteed layout shift.

Verify the Largest Contentful Paint element is not lazy — this is the single check worth doing first.

Test on a slow connection profile. The browser widens its loading margin when the connection is slow, and a configuration that looks correct on a fast link may fetch everything at once on a throttled one.

Frequently asked questions

Should I lazy-load all images?
No. Images visible on load must be eager. Lazy-loading the hero image delays the Largest Contentful Paint element and makes the metric worse.
Does lazy loading need JavaScript?
No. The loading attribute is implemented natively by every current browser for images and iframes.
Does lazy loading cause layout shifts?
It does if the image has no width and height to reserve space with. With dimensions set, the space is reserved before the file arrives.

Sources

Related

VeriFixScan crawls a site and applies its checks to every page it reaches, keeping the evidence behind each finding. Scanning one website is free.

Scan a website