Public BetaVitalSentinel is now live! Read the announcement
Performance

What is Lazy Loading?

A design pattern that defers the loading of non-critical resources until they are needed, typically when they enter the viewport.

Lazy loading delays loading resources until they're actually needed, typically when they're about to scroll into view. This reduces initial page load time and saves bandwidth.

What to lazy load

  • Images: Load when entering viewport
  • Videos: Load when user interacts
  • Iframes: Load when visible
  • JavaScript: Load on demand (code splitting)

Native lazy loading

Modern browsers support native lazy loading for images and iframes:

<img src="image.jpg" loading="lazy" alt="Description">
<iframe src="video.html" loading="lazy"></iframe>

loading attribute values

  • lazy: Defer loading until near viewport
  • eager: Load immediately (default)

Lazy loading and LCP

Important: Don't lazy load your LCP element! The largest contentful paint should load as quickly as possible. Lazy loading is for below-the-fold content.

Best practices

  1. Don't lazy load above-the-fold images
  2. Provide width and height to prevent CLS
  3. Use a low-quality placeholder (LQIP)
  4. Consider using fetchpriority="high" for critical images

Monitor your website performance

VitalSentinel tracks Core Web Vitals and performance metrics to help you stay ahead of issues.