Lazy loading

Also called lazy load or deferred loading

A technique that waits to load images, videos, or code until they are about to scroll into view, so the first screen loads faster.

What is Lazy loading?

A long page may hold dozens of images, but a visitor sees only a few at first. Lazy loading fetches each one only when it gets close to the viewport, shortly before it scrolls into view. The first screen loads sooner, and people who never scroll down never download the rest.

For images and iframes, the browser does the work with loading="lazy", and the Next.js next/image component lazy-loads by default. For other content, an IntersectionObserver reports when an element nears the viewport, and a dynamic import() delays loading code until it is needed.

Pair it with a placeholder so the layout doesn’t jump: give each image a width and height (or an aspect-ratio), then show a solid color or a tiny blurred preview that sharpens when the full image arrives, the blur-up technique in the demo. Don’t lazy-load images in the first screen, especially the hero image, because that delays the page’s main content.

Often confused with

Infinite scroll
Infinite scroll adds new items to a list when you reach the end. Lazy loading delays loading things that are already on the page until they near the screen.

Common errors

Failed to fetch dynamically imported module
The browser asked for a piece of your app that no longer exists, usually because a new deploy replaced it while the page was open.
All terms

Infinite scroll

A list that loads the next batch of items automatically as you scroll near the bottom, so the feed seems to never end.

Skeleton screen

A loading placeholder made of gray blocks shaped like the content on its way, often with a soft shimmer, that the real content replaces.

Perceived performance

How fast an app feels to people, which skeleton screens, instant feedback, and progressive loading can improve even when the real wait stays the same.

Blur

A softening effect made with CSS filter: blur() on an element itself, or backdrop-filter: blur() on whatever shows through it from behind.