# Lazy-load offscreen content

- Check 06.19 · Performance and Core Web Vitals · Important
- Source: https://checklist-seo-geo.com/en/performance-core-web-vitals/lazy-load-offscreen-content
- Only load offscreen images, iframes and videos as the visitor scrolls near them, with loading lazy and the settings specific to each CMS and framework.
- Updated on 2026-11-25
- Licence: CC BY 4.0. Credit “Checklist SEO & GEO” with a link to https://checklist-seo-geo.com/en/performance-core-web-vitals/lazy-load-offscreen-content.
- Plugin checklist-seo-geo: 1.3.1 · https://github.com/maximegaul/checklist-seo-geo

## In short

Lazy loading means downloading an image, an iframe or a video only when the visitor gets close to it while scrolling the page. The HTML `loading="lazy"` attribute is enough in the vast majority of cases, with no JavaScript library. The rule fits in two lines: everything below the first screen is deferred, nothing in the first screen is. Once this check is done, the initial load only downloads the media that are actually visible.

## Why it matters

Without instructions, the browser downloads every image in the HTML at load time, including those in the footer that many visitors will never see. These requests share bandwidth with the CSS, the fonts and the main image: on a mobile connection, they delay what matters. An iframe is even worse, as it loads an entire document with its own scripts.

With `loading="lazy"`, the browser holds the request back as long as the element is far from the visible area, then starts it as scrolling brings it closer, with a margin it adjusts itself.

As for search engines, two points to know:

- Googlebot does not scroll the page or click. It renders the page in a very tall viewport, which triggers native lazy loading and scripts based on `IntersectionObserver`.
- A script that waits for a scroll event (`scroll`) or an interaction never fires for Googlebot: the images, and any content loaded this way, remain invisible to indexing.

Native lazy loading is therefore the safest choice for SEO as well as for performance.

## What it improves

- **Initial load**: fewer requests and bytes competing with critical resources, and therefore a faster LCP (Largest Contentful Paint, the display of the largest visible element) on media-heavy pages. The effect is indirect.
- **Mobile data and costs**: media that are never seen are never downloaded. Less bandwidth for the visitor, the server and the CDN.
- **Responsiveness**: deferred iframes (videos, maps) do not run their scripts at load time, which relieves the main thread.
- **Rankings**: indirect effect, through Core Web Vitals. Applied badly (main image deferred, content invisible to crawlers), the effect is negative.

## How to check

Load the page without scrolling, then run the following in the console.

Offscreen images that are not deferred (to fix):

```js
[...document.images]
  .filter((img) => img.loading !== 'lazy' && img.getBoundingClientRect().top > window.innerHeight)
  .map((img) => img.currentSrc || img.src);
```

First-screen images wrongly deferred (also to fix):

```js
[...document.images]
  .filter((img) => img.loading === 'lazy' && img.getBoundingClientRect().top < window.innerHeight)
  .map((img) => img.currentSrc || img.src);
```

Compliant result: two empty arrays, at mobile width as well as desktop width.

Other checks:

- **Network tab, “Img” filter**: after loading without scrolling, only the images at the top of the page are listed. New lines appear as you scroll.
- **Iframes**: `document.querySelectorAll('iframe:not([loading="lazy"])')` lists those that load immediately.
- **Google's view**: in Search Console, inspect the URL, run Test live URL and open the rendered HTML. The `<img>` tags at the bottom of the page must carry their real `src`. See [test rendering in Search Console](https://checklist-seo-geo.com/en/javascript-html-rendering/test-rendering-search-console).

## How to implement

### Before you start

Target tags:

```html
<img src="/images/atelier-800.webp" width="800" height="533"
     alt="Assembly station in the workshop" loading="lazy" decoding="async">

<iframe src="https://www.youtube-nocookie.com/embed/VIDEO_ID" width="560" height="315"
        title="Product demo" loading="lazy" allowfullscreen></iframe>

<video controls preload="none" poster="/images/demo-poster.webp" width="1280" height="720">
  <source src="/videos/demo.mp4" type="video/mp4">
</video>
```

Rules that apply everywhere:

- **Always with `width` and `height`** (or a CSS `aspect-ratio`): a deferred image without dimensions causes a layout shift when it arrives. See [reserve space for media and ads](https://checklist-seo-geo.com/en/performance-core-web-vitals/reserve-space-media-ads).
- **Never in the first screen**, and above all not on the main image. See [optimize the LCP image without lazy loading](https://checklist-seo-geo.com/en/performance-core-web-vitals/optimize-lcp-image-without-lazy-loading).
- **In a `<picture>` element**, the attribute goes on the `<img>`, not on the `<source>` elements.
- **Videos**: `preload="none"` with a `poster` image avoids downloading the beginning of the file. For a YouTube or Vimeo video, a clickable facade is lighter still: see [limit third-party scripts](https://checklist-seo-geo.com/en/performance-core-web-vitals/limit-third-party-scripts).

CSS background images have no `loading` attribute. Defer them with a class added as they approach the visible area:

```css
.promo {
  min-height: 320px;
  background-color: #f2f2f2;
  background-size: cover;
}

.promo.is-visible {
  background-image: url("/images/promo-1200.webp");
}
```

```html
<section class="promo js-lazy-background">
  <h2>Offer of the month</h2>
</section>

<script>
  var backgroundObserver = new IntersectionObserver(function (entries) {
    entries.forEach(function (entry) {
      if (!entry.isIntersecting) {
        return;
      }

      entry.target.classList.add('is-visible');
      backgroundObserver.unobserve(entry.target);
    });
  }, { rootMargin: '200px' });

  document.querySelectorAll('.js-lazy-background').forEach(function (element) {
    backgroundObserver.observe(element);
  });
</script>
```

> **Warning:** if you use a JavaScript lazy loading library (`data-src` attributes), check that it relies on `IntersectionObserver` and not on the `scroll` event, and check the rendered HTML in Search Console. Native lazy loading avoids this risk.

### WordPress

Versions: WordPress 6.4 and later (checked on 7.1).

WordPress adds `loading="lazy"` to images that have dimensions (since version 5.5) and to iframes (since 5.7), sparing the first images in the content. In principle there is nothing to enable. Points to check:

- **Images hard-coded in the theme** (`<img src="...">` in a PHP file): they escape the mechanism. Use `wp_get_attachment_image()` or add the attribute by hand.
- **Images without dimensions**: WordPress does not defer them. Fill in `width` and `height`.
- **Exclude a specific image** from lazy loading, for example with a `no-lazy` CSS class:

```php
add_filter('wp_img_tag_add_loading_attr', function ($value, string $image) {
    if (str_contains($image, 'no-lazy')) {
        return false;
    }

    return $value;
}, 10, 2);
```

Plugins (WP Rocket's `Media` tab, LiteSpeed Cache's `Page Optimization > Media Settings`, Perfmatters, Autoptimize) add their own script-based lazy loading. They are useful for what native lazy loading does not cover: CSS backgrounds and replacing YouTube iframes with a preview image. Do not stack two plugins on the same feature, and check that the main image is excluded.

### Shopify

Versions: Online Store 2.0 themes, Liquid, all Shopify plans, November 2026.

The `image_tag` filter automatically defers images in sections located further down the page. In a product grid, decide based on position:

```liquid
{%- for product in collection.products -%}
  {%- if forloop.index <= 4 -%}
    {%- assign image_loading = 'eager' -%}
  {%- else -%}
    {%- assign image_loading = 'lazy' -%}
  {%- endif -%}

  {{ product.featured_image | image_url: width: 600 | image_tag: loading: image_loading, alt: product.title }}
{%- endfor -%}
```

Images inserted into product descriptions and pages through the rich text editor do not go through `image_tag`: add the attribute in the editor's HTML if there are many of them.

### PrestaShop

Versions: PrestaShop 8 and 9, Classic and Hummingbird themes.

The Classic and Hummingbird themes shipped with PrestaShop 8 and 9 already put `loading="lazy"` on product thumbnails (`templates/catalog/_partials/miniatures/product.tpl` in Classic, `product-image.tpl` in the same folder for Hummingbird). On an older or custom theme, add the attribute in this template and in the templates of modules that display images below the first screen (brands, related products, blog). Images entered in CMS pages and descriptions need the attribute in the editor. Clear the cache in `Advanced Parameters > Performance`.

### Magento

Versions: Magento Open Source and Adobe Commerce 2.4 (2.4.6 to 2.4.9), Luma and Blank themes.

In Luma and Blank, the product list thumbnails (`Magento_Catalog/templates/product/image_with_borders.phtml`) already carry `loading="lazy"`. Check the HTML of category pages with a third-party or custom theme, and add the attribute in a template override if needed. This template also defers the first row: if it is in the first screen, override the template to exclude it. Images in CMS blocks and Page Builder are set in the content's HTML. Flush the caches (`bin/magento cache:flush`).

### Drupal

Versions: Drupal 10 and 11.

Drupal adds `loading="lazy"` to images rendered by an image field as soon as their dimensions are known. Two settings complement this:

- **Per field**: `Structure > Content types > your type > Manage display`, the image field's gear icon, image loading setting (lazy or eager).
- **Images inserted in the body text**: `Configuration > Content authoring > Text formats and editors`, enable the “Lazy load images” filter for each text format. It relies on the filter that tracks images uploaded through the editor to know their dimensions.

### Wix

Versions: Wix Editor and Wix Studio, Squarespace 7.1, November 2026.

Automatic: the platform defers offscreen media itself. The same applies to Squarespace.

### Webflow

Versions: Webflow Designer, November 2026.

Each Image element has a loading setting, set to “Lazy” by default. Leave it that way everywhere except in the first screen, where it should be “Eager”.

### Laravel

Versions: Laravel 11 to 13.

The simplest approach is a Blade component that defers by default, with an option for the first screen. In `resources/views/components/image.blade.php`:

```html
@props(['src', 'alt', 'width', 'height', 'eager' => false])

<img src="{{ $src }}" alt="{{ $alt }}" width="{{ $width }}" height="{{ $height }}"
     @if($eager) fetchpriority="high" @else loading="lazy" decoding="async" @endif
     {{ $attributes }}>
```

Usage:

```html
<x-image src="/images/atelier-800.webp" alt="Assembly station in the workshop" width="800" height="533" />
```

For HTML entered in an editor and stored in the database, add the attribute when saving or rendering:

```php
$html = preg_replace('/<img(?![^>]*\bloading=)/i', '<img loading="lazy"', $html);
```

This replacement affects every image in the content: if the first one can appear in the first screen, handle it separately.

### Symfony

Versions: Symfony 6.4, 7.4 and 8.x, Twig 3.

Same principle with a Twig macro or component:

```twig
{% macro image(src, alt, width, height, eager = false) %}
    <img src="{{ src }}" alt="{{ alt }}" width="{{ width }}" height="{{ height }}"
         {% if eager %}fetchpriority="high"{% else %}loading="lazy" decoding="async"{% endif %}>
{% endmacro %}
```

### Next.js

Versions: Next.js 15 and 16 (App Router and Pages Router).

The `next/image` component defers by default: there is nothing to add, you just need to avoid disabling it anywhere other than in the first screen. For a first-screen image, write `loading="eager"`, or `preload` for the LCP image; the `priority` prop has been deprecated since Next.js 16 but remains the only preload option on Next.js 15. For an iframe, write `loading="lazy"`. For a heavy component located low on the page, `next/dynamic` postpones the download of its code.

### Nuxt

Versions: Nuxt 4 (and Nuxt 3, end of life since July 2026), @nuxt/image module 1 and 2.

`NuxtImg` does not defer by default: add the attribute.

```html
<NuxtImg src="/images/atelier.jpg" width="800" height="533" format="webp"
         alt="Assembly station in the workshop" loading="lazy" />
```

For a component located below the first screen, the `Lazy` prefix postpones the download of its code, and since Nuxt 3.16 the `hydrate-on-visible` prop delays its hydration until it is visible:

```html
<LazyCommentList hydrate-on-visible />
```

### Astro

Versions: Astro 5 to 7.

The `Image` component outputs `loading="lazy"` and `decoding="async"` by default. For a framework component located low on the page, the `client:visible` directive only loads its JavaScript as it approaches the visible area:

```html
<CommentList client:visible />
```

## Common mistakes

- **Deferring the main image or the logo**: the LCP slips. This is the most common mistake, often caused by a global plugin setting.
- **Deferring without dimensions**: each image that arrives pushes the content down, and CLS (Cumulative Layout Shift) climbs.
- **A library based on the `scroll` event**: images missing from Googlebot's render.
- **`data-src` attributes with no fallback**: without JavaScript, or if the script fails, no image is displayed.
- **Combining native lazy loading and script-based lazy loading** on the same images: unpredictable behavior and flickering images.
- **Deferring text**: loading the main content or reviews on scroll makes them invisible to crawlers. See [make content accessible without user interaction](https://checklist-seo-geo.com/en/javascript-html-rendering/make-content-accessible-without-user-interaction).
- **Forgetting iframes**: a map or a video embedded at the bottom of the page often weighs more than all the images put together.
- **Replacing images with heavy previews encoded in the HTML**: the document grows and the gain disappears.

## Frequently asked questions

### Is lazy loading bad for SEO?

No, if it is native or based on IntersectionObserver. Googlebot does not scroll the page, but it renders it in a very tall viewport that triggers the loading="lazy" attribute. The risk comes from scripts that wait for a scroll event or an interaction: what they load remains invisible to indexing. It also comes from lazy loading applied to the main image, which delays the LCP.

### Should I put loading="lazy" on every image?

No. Defer everything below the first screen, and nothing in it. The main image, the logo and the visuals visible at load time must stay without lazy loading, otherwise the browser requests them late and the LCP slips. Also give width and height attributes to every deferred image, to avoid a layout shift when it arrives.

### Do I still need a JavaScript lazy loading library?

In the vast majority of cases, no: the HTML loading="lazy" attribute is enough for images and iframes, with no script. A library remains useful for what native lazy loading does not cover, such as CSS background images or replacing video iframes with a preview image. In that case, check that it relies on IntersectionObserver, and do not combine both mechanisms on the same images.

### Does WordPress apply lazy loading automatically?

Yes. WordPress has added loading="lazy" to images that have dimensions since version 5.5, and to iframes since 5.7, sparing the first images in the content. Images hard-coded in the theme and those without dimensions escape it. If an optimization plugin adds its own lazy loading, check that it excludes the main image and do not stack two of them.

## Resources

- [web.dev: Browser-level image lazy loading for the web](https://web.dev/articles/browser-level-image-lazy-loading?hl=en)
- [MDN: Lazy loading](https://developer.mozilla.org/en-US/docs/Web/Performance/Guides/Lazy_loading)
- [Google Search Central: Fix lazy-loaded content](https://developers.google.com/search/docs/crawling-indexing/javascript/lazy-loading?hl=en)
- [WordPress: Lazy-loading images in 5.5](https://make.wordpress.org/core/2020/07/14/lazy-loading-images-in-5-5/)
- [Shopify: image_tag filter](https://shopify.dev/docs/api/liquid/filters/image_tag)
- [Drupal: Native lazy loading of images](https://www.drupal.org/node/3173719)
- [Nuxt: Delayed or lazy hydration of components](https://nuxt.com/docs/4.x/directory-structure/app/components#delayed-or-lazy-hydration)
- [Astro: Client directives](https://docs.astro.build/en/reference/directives-reference/#client-directives)

Next steps: [optimize the LCP image without lazy loading](https://checklist-seo-geo.com/en/performance-core-web-vitals/optimize-lcp-image-without-lazy-loading), [reserve space for media and ads](https://checklist-seo-geo.com/en/performance-core-web-vitals/reserve-space-media-ads) and [lazy-load offscreen images](https://checklist-seo-geo.com/en/images-multimodal-search/lazy-load-offscreen-images).
