# Lazy Loading

> Pictures and code that load late, just as the reader gets near them.

**Field:** Software Development  
**Category:** Web Development  
**Also known as:** Lazy Load, loading="lazy", Deferred Loading

## Think of it like

It is like a waiter who brings each dish just when you want it.

## Definition

Lazy loading means a page waits to load a thing until the reader is about to need it. Pictures far down a long page are not fetched at first. As the reader scrolls near one, the browser fetches it. In HTML, you add loading="lazy" to an image or an iframe. The page shows up sooner and uses less data. The same idea applies to code that a page loads in parts.

## Example

Lucy's photo blog has 60 pictures per page. With lazy loading, only the first few load, and the page opens in a second.

## Example code

```html
<img src="beach.jpg" alt="Waves on a sandy beach" loading="lazy">
```

The browser fetches this picture only when the reader scrolls near it.

## Why it matters

A faster first view keeps readers on the page. People on phones also save data they would never have used.

## Common mistake

Lazy loading the big picture at the top. It then loads late, and the page feels slower, not faster.

## Three principles

- **Load when near.** Fetch just before it comes into view.
- **Faster first view.** The top of the page comes first.
- **Not the top picture.** Load what is seen at once right away.

## Related terms

- [Core Web Vitals](https://learn.benibix.com/term/marketing/core-web-vitals)
- [Responsive Images](https://learn.benibix.com/term/design/responsive-images)
- [JavaScript Bundler](https://learn.benibix.com/term/development/bundler)
- [Infinite Scroll](https://learn.benibix.com/term/design/infinite-scroll)
- [HTML Element](https://learn.benibix.com/term/development/html-element)

## Told apart from

- [Lazy Loading vs Infinite Scroll](https://learn.benibix.com/compare/lazy-loading-vs-infinite-scroll): People think lazy loading and infinite scroll are the same trick, and they are not. Lazy loading waits to fetch a picture that is already part of the page until you scroll near it. Infinite scroll adds new items to the end of the page as you reach the bottom. A feed often uses both at once.

![A long web page with the browser window drawn over its top part. The two pictures inside the window are loaded. The three pictures below the window are grey empty boxes, marked not loaded yet. An arrow shows that as the reader scrolls down, the next picture loads just before it comes into view.](https://learn.benibix.com/diagrams/dev5-lazy-loading.svg)

---

Source: https://learn.benibix.com/term/development/lazy-loading
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-17
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
