Free auditStart free
GlossaryGlossary · Performance

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.

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 withChatGPTClaudePerplexityGoogleAI Mode
01Explained

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.

02Check 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 and lazy loading the rest gives fewer bytes loaded and improved 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>
03Explained

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.

04Explained

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 in Search Console and confirm in the rendered HTML that the image src attributes are present.

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. 01Browser-level image lazy-loading for the webweb.dev · checked 2026-10-24
  2. 02Lazy loading (MDN)developer.mozilla.org · checked 2026-10-24
  3. 03Fix lazy-loaded website content (Google Search Central)developers.google.com · checked 2026-10-24
  4. 04The performance effects of too much lazy loadingweb.dev · checked 2026-10-24
Questions

Asked a lot.

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

01Does 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.

02Should 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.

03What 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().

Free · 2 minutes

Know the term. Now check your site.

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

Free, no card60 secondsNobody will call you
  • 46 fixes shipped without a ticket Brightpipe
  • +212% organic clicks in 90 days Ledgerly