What is Lazy Loading?
Lazy loading defers fetching or initializing a resource until it is needed or approaches use. Native HTML image lazy loading lets the browser delay offscreen image requests according to its own loading policy.
How Lazy Loading works
An image with loading="lazy" can be fetched before it becomes visible, using a browser-selected distance from the viewport. The browser controls the threshold, so the attribute is not a precise scroll trigger. This scheduling is independent of encoding or resizing: a lazily fetched image can still be much larger than needed. Responsive sources and suitable derivatives reduce the eventual transfer, while lazy loading changes when it begins.
Key facts
- A placeholder and lazy loading solve different problems. The placeholder supplies temporary appearance; loading policy schedules the real resource.
- Deferring a prominent image can delay the page’s largest contentful paint. Evaluate the actual initial viewport before applying lazy loading to every image.
- Browsers defer native
loading="lazy"image requests only when scripting is enabled. Do not depend on this attribute to prevent a request.
When Lazy Loading matters
Lazy-load images below the initial viewport while keeping important first-screen imagery promptly available. Reserve dimensions so that an image’s arrival does not move surrounding content.