# Lazy loading

> How to lazy load images and iframes with loading="lazy", when it hurts LCP, how Google sees lazy content, and how to split JavaScript.

Canonical: https://scaplet.com/glossary/lazy-loading

Glossary Glossary · Performance

How to lazy load images and iframes with loading="lazy", when it hurts LCP, how Google sees lazy content, and how to split JavaScript.

3 min

read

4

sources

Oct 24, 2026

updated

Scaplet Editorial Team

author

In one line

Lazy loading defers non-critical resources until they are needed. For images and iframes, add loading="lazy" and the browser waits until they are near the viewport. Never lazy load images that are likely visible on first load, especially the LCP image, because web.dev found it delays Largest Contentful Paint.

30-second check

## Is this costing your site traffic?

Four quick questions, then a straight answer.

1/4Have you checked your own site for this?

Summarize this page with [ChatGPT](https://chatgpt.com/?hints=search&q=Summarize%20https%3A%2F%2Fscaplet.com%2Fglossary%2Flazy-loading%20(%22Lazy%20loading%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.) [Claude](https://claude.ai/new?q=Summarize%20https%3A%2F%2Fscaplet.com%2Fglossary%2Flazy-loading%20(%22Lazy%20loading%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.) [Perplexity](https://www.perplexity.ai/search?q=Summarize%20https%3A%2F%2Fscaplet.com%2Fglossary%2Flazy-loading%20(%22Lazy%20loading%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.) [![Google](/logos/ai/google-color.svg)AI Mode](https://www.google.com/search?udm=50&q=Summarize%20https%3A%2F%2Fscaplet.com%2Fglossary%2Flazy-loading%20(%22Lazy%20loading%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.)

On this page

## 5 parts, 3 minutes.

1. [What lazy loading does 01](#what-lazy-loading-does)
2. [Lazy load images the right way 02](#lazy-load-images-the-right-way)
3. [Lazy load JavaScript 03](#lazy-load-javascript)
4. [Will Google see lazy-loaded content? 04](#will-google-see-lazy-loaded-content)
5. [Common mistakes 05](#common-mistakes)

_01_Explained

## What lazy loading does

Lazy loading is a strategy to defer loading non-critical resources until they are needed. Images and iframes are the usual targets. MDN notes the `loading` attribute also works on `<video>` and `<audio>` elements. JavaScript can be lazy loaded too, through code splitting.

The native way is the `loading` attribute. `lazy` defers loading until the resource reaches a calculated distance from the viewport. `eager` is the default and loads it regardless. web.dev says the attribute works only on `<img>` tags, not on CSS background images.

_02_Check it

## Lazy load images the right way

web.dev's rule: "Don't lazy-load images that are likely to be in-viewport when the page loads, especially LCP images." Its HTTP Archive data shows sites using lazy loading tend to have worse LCP, though that is correlational. In its WordPress A/B test, disabling lazy loading improved median LCP by 13% on desktop archive pages and 15% on mobile archive pages, while single pages changed within normal variance. It concludes that eagerly loading images in the [initial viewport](/glossary/above-the-fold) and lazy loading the rest gives fewer bytes loaded and improved [Core Web Vitals](/glossary/core-web-vitals).

Set `width` and `height` on every image. web.dev notes that without them images default to 0x0 pixels before loading, which can cause layout shifts and make the browser load many images at once.

Eager hero, lazy below the fold

```
<!-- Visible on load: leave eager (the default) --> <img src="hero.jpg" width="1200" height="630" alt="Dashboard overview"> <!-- Below the fold: defer --> <img src="gallery-1.jpg" width="800" height="450" alt="Gallery photo" loading="lazy"> <iframe src="https://example.com/embed" width="560" height="315" title="Demo video" loading="lazy"></iframe>
```

_03_Explained

## Lazy load JavaScript

MDN says code can be split into smaller chunks, with the rest loaded on demand, and lists dynamic splitting with `import()` expressions as one approach:

Load a module on first click

```
const button = document.getElementById('chat'); button.addEventListener('click', async () => { const { initChat } = await import('./chat.js'); initChat(); });
```

MDN says this sends the minimal code required to provide value upfront, which improves page-load times. Advice, not from the sources: do not lazy load code the first render depends on.

_04_Explained

## Will Google see lazy-loaded content?

Yes, if it is implemented so that content loads whenever it is visible in the viewport. Google's guidance endorses browser built-in lazy loading for images and iframes, and the IntersectionObserver API with a polyfill. Both avoid depending on user actions, which matters because Google Search does not interact with your page.

Google warns that lazy loading done incorrectly can inadvertently hide content from Google, and that content which depends on user actions such as scrolling or clicking is not safe, because Google Search does not interact with your page. To check, run [URL Inspection](/glossary/url-inspection-tool) in [Search Console](/glossary/google-search-console) and confirm in the [rendered HTML](/glossary/rendered-html) that the image `src` attributes are present.

_05_At a glance

## Common mistakes

Mistake

### `loading="lazy"` on the hero image

Result

Worse LCP

Fix

Remove it; leave the default eager

Mistake

### No `width` and `height`

Result

Layout shifts; the browser may decide all images fit in the viewport and load them at once

Fix

Add dimensions to every image

Mistake

### Lazy loading on CSS background images

Result

Attribute has no effect

Fix

Use an `<img>` or an IntersectionObserver

Mistake

### Images loaded only on scroll events

Result

Google may not see them

Fix

Use native lazy loading or IntersectionObserver

Related: [image compression](/glossary/image-compression), [Core Web Vitals](/glossary/core-web-vitals).

Sources · 4

## Every fact, linked and dated.

Official docs first. The date is when we last opened each page.

- web.dev
- mozilla.org
- google.com

1. 01 [Browser-level image lazy-loading for the web](https://web.dev/articles/browser-level-image-lazy-loading) web.dev · checked 2026-10-24
2. 02 [Lazy loading (MDN)](https://developer.mozilla.org/en-US/docs/Web/Performance/Guides/Lazy_loading) developer.mozilla.org · checked 2026-10-24
3. 03 [Fix lazy-loaded website content (Google Search Central)](https://developers.google.com/search/docs/crawling-indexing/javascript/lazy-loading) developers.google.com · checked 2026-10-24
4. 04 [The performance effects of too much lazy loading](https://web.dev/articles/lcp-lazy-loading) web.dev · checked 2026-10-24

Questions

## Asked a lot.

3 questions people ask next, answered from the sources on this page.

_01_ Does lazy loading hurt SEO?

Not when done correctly. Google says it can crawl lazy-loaded content that loads whenever it is visible in the viewport, and recommends native lazy loading or IntersectionObserver. It can hide content when loading depends on user actions like scrolling or clicking.

_02_ Should I lazy load every image?

No. Skip images likely to be visible when the page loads, especially the LCP image. web.dev warns that lazy loading these delays LCP. Lazy load images further down the page.

_03_ What is the difference between lazy loading and code splitting?

Lazy loading is the general idea of deferring non-critical resources. Code splitting is that idea applied to JavaScript: smaller chunks loaded on demand with dynamic import().

## Keep learning

[All glossary](/glossary)

[Learn Image compression Performance](/glossary/image-compression) [Related LCP image is lazy-loaded Performance](/seo-issues/lazy-loaded-lcp-image) [Read next Page speed Performance](/glossary/page-speed) [Do Run a free site audit Free, about two minutes](/site-audit)

Nearby in glossary
[Last touch attribution](/glossary/last-touch-attribution) [lastmod](/glossary/lastmod) [Lead magnet](/glossary/lead-magnet) [Lead scoring](/glossary/lead-scoring)

More in Performance
[Edge caching](/glossary/edge-caching) [fetchpriority](/glossary/fetchpriority) [First Contentful Paint](/glossary/first-contentful-paint) [First Input Delay (FID)](/glossary/first-input-delay) [font-display](/glossary/font-display) [Gzip compression](/glossary/gzip-compression) [HTTP caching](/glossary/http-caching) [HTTP/2](/glossary/http-2) [HTTP/3](/glossary/http-3) [Image compression](/glossary/image-compression) [Interaction to Next Paint (INP)](/glossary/interaction-to-next-paint) [Largest Contentful Paint](/glossary/largest-contentful-paint) [Lazy loading](/glossary/lazy-loading) [Lighthouse](/glossary/lighthouse) [Page experience](/glossary/page-experience) [Page speed](/glossary/page-speed) [PageSpeed Insights](/glossary/pagespeed-insights) [preconnect](/glossary/preconnect) [preload](/glossary/preload) [Progressive web app](/glossary/progressive-web-app) [Real user monitoring (RUM)](/glossary/real-user-monitoring) [Render-blocking](/glossary/render-blocking) [Responsive design](/glossary/responsive-design) [Responsive images](/glossary/responsive-images)

Terms on this page
[Above the fold](/glossary/above-the-fold) [Core Web Vitals](/glossary/core-web-vitals) [URL Inspection tool](/glossary/url-inspection-tool) [Google Search Console](/glossary/google-search-console) [Rendered HTML](/glossary/rendered-html) [Image compression](/glossary/image-compression)

Free · 2 minutes

## Know the term. _Now check your site._

The free audit reads robots.txt, sitemaps, status codes, canonicals, redirects and structured data.

[Audit my site free](/site-audit)

Free, no card 60 seconds Nobody will call you

- **46** fixes shipped without a ticket Brightpipe
- **+212%** organic clicks in 90 days Ledgerly
