Lazy loading images and video: how to do it right

How lazy loading images and video works, native loading attributes, what not to lazy-load, effects on LCP and CLS, and setup in WordPress and Shopify.

Usman Muhammad UsmanUpdated October 13, 2026
Lazy loading images and video: how to do it right

Lazy loading delays images and videos until the visitor scrolls near them, so the browser can focus on what is visible first. It saves bandwidth and speeds up loading, especially on long pages. Done wrong, it can actually slow down the most important content. Here is how to use it correctly.

How lazy loading works

Without lazy loading, browsers start downloading every image on a page as soon as they find it, even images far below the screen. With lazy loading, offscreen images wait until the visitor scrolls close to them. The page’s initial load requires fewer downloads and less data.

Modern browsers support native lazy loading with the loading attribute set to lazy on images and iframes. No JavaScript is needed, and the browser decides when to load based on scroll position and connection speed.

Native lazy loading in WordPress

WordPress adds loading lazy to images and iframes in content automatically. Since version 5.9 it skips the first image or images that are likely to be above the fold, and newer versions add fetchpriority high to the likely LCP image.

Themes, page builders and plugins sometimes override this behaviour, adding lazy loading to every image including the hero. Check the HTML of your homepage and key pages to see which images have loading lazy.

Lazy loading rules
  • Native attributeloading lazy
  • Not above the foldHero and main image eager
  • fetchpriority highOn the LCP image
  • Dimensions setNo layout shift
  • Video facadesLoad player on click
  • Test on slow networkNo blank gaps

Never lazy-load the LCP image

The Largest Contentful Paint element is often a hero image, banner or main product image. If it is lazy-loaded, the browser waits to load it until layout is calculated, which delays LCP. PageSpeed Insights warns about this as a lazy-loaded LCP image.

Remove lazy loading from images in the first screen and add fetchpriority high to the main one. In page builders, look for a setting to disable lazy loading per image or section. My guide to improving LCP covers this.

Prevent layout shift

Lazy-loaded images that do not have width and height can cause layout shift when they load, because the browser did not reserve space. Always set dimensions on images or use CSS aspect-ratio on containers.

Placeholders, such as a solid colour or a low-quality blurred preview, can make loading feel smoother. Keep them lightweight; heavy placeholder scripts cancel out the benefit. See fixing layout shift.

Lazy loading background images

CSS background images are not covered by the loading attribute. Page builders often use them for sections, and some performance plugins can lazy-load them with JavaScript. Elementor includes a lazy load option for background images in its performance settings.

Do not lazy-load background images in the first screen, especially hero sections. For important visuals, consider using a regular image element instead of a background, which loads earlier and supports srcset.

Lazy loading videos and iframes

Embedded videos from YouTube or Vimeo load heavy players and scripts even before the visitor presses play. Native lazy loading on iframes helps for videos further down the page. For bigger savings, use a facade: a static thumbnail that loads the real player only when clicked.

Facades can save hundreds of kilobytes per video. Many performance plugins offer this feature, and there are lightweight YouTube embed components. See embedding YouTube videos without slowing your page.

Shopify themes

Most modern Shopify themes use native lazy loading for images below the fold and eager loading for the first section. Check your theme’s homepage and product templates to confirm the hero and main product image are not lazy-loaded.

Apps that add images, such as reviews or Instagram feeds, may handle lazy loading differently. Test pages after installing apps. See speeding up a Shopify store.

JavaScript lazy loading libraries

Before native lazy loading was widely supported, sites used JavaScript libraries. Many plugins still offer JavaScript-based lazy loading, which can be useful for background images and older browsers, but adds script work.

For most sites today, native lazy loading is enough for images and iframes. Use JavaScript solutions only where native support does not cover your needs, and avoid running two lazy loading systems at once.

Lazy loading and SEO

Search engines can see lazy-loaded images when they use standard methods, such as native loading attributes or images in the HTML with proper src attributes. Images loaded only after scroll events with no src in the HTML may not be indexed.

Use native lazy loading or well-supported libraries that keep image URLs in the HTML. Check with Google’s URL Inspection tool that important images render. See image SEO.

Testing your setup

View the page source or inspect elements to check which images have loading lazy and which have fetchpriority high. Run PageSpeed Insights to see warnings about lazy-loaded LCP images and offscreen images that are not deferred.

Scroll through the page on a slow connection to make sure images load in time and do not leave blank spaces. Adjust thresholds in plugins if images appear too late.

Getting help

Lazy loading is a quick win when configured correctly. I review and fix image loading as part of my speed optimization service.

For image format and compression, read WebP vs AVIF vs JPEG and image optimization for WooCommerce.

Key takeaways

  • Lazy-load images and iframes below the fold with the native attribute.
  • Never lazy-load the LCP image; give it high fetch priority.
  • Set image dimensions to prevent layout shift.
  • Use facades for embedded videos to save heavy player scripts.

Frequently asked questions

Does WordPress lazy-load images automatically?

Yes, for images in content, skipping likely above-the-fold images. Themes and builders may change this.

Is lazy loading bad for SEO?

No, if images remain in the HTML with proper src attributes, as with native lazy loading.

Should I lazy-load all images?

No. Images visible on load, especially the LCP image, should load immediately.

Can I lazy-load background images?

Not with the native attribute. Some plugins and builders offer JavaScript-based options.

What is a video facade?

A thumbnail that looks like a player and loads the real video player only when clicked.

Free website audit

Get a free audit of your website

Tell me your URL and I'll send a short, prioritized list of the speed, SEO and security fixes that will make the biggest difference.

  • No obligation, no sales call
  • 5.0 rating on Google and Upwork
  • Reply within one business day
Written by Muhammad UsmanWeb Development Team Lead with 5+ years building WordPress, WooCommerce, Shopify and Wix websites. Experience · Certificates About me

More on Speed & Core Web Vitals

All Speed & Core Web Vitals articles

Have a project in mind?

Tell me what you're building and I'll reply with next steps and an estimate.