🖼 Native image lazy loading

On this page
<img src="image.jpg" alt="Description" loading="lazy" width="800" height="600" />

Always include width and height attributes to prevent layout shift while the image loads.

Values Jump to heading

  • lazy: Defer loading until it reaches a calculated distance from viewport
  • eager: Load the resource immediately
  • auto: Browser default (typically eager)

When to use Jump to heading

  • ✅ Images below the fold (not immediately visible)
  • ✅ Images in long lists or feeds
  • ❌ Hero images or LCP (Largest Contentful Paint) images - use eager or omit the attribute
  • ❌ Images already in the viewport on load

With iframes Jump to heading

<iframe src="video-player.html" loading="lazy"></iframe>

fetchpriority for important images Jump to heading

For above-the-fold images, use fetchpriority to load them faster:

<img src="hero.jpg" alt="Hero" fetchpriority="high" />

References Jump to heading


← Back home