Lazy loading
What is lazy loading?
Lazy loading is a technique that delays loading resources, usually images and iframes, until they are near the visible part of the screen. Instead of downloading every image on a long page at once, the browser fetches each one as the visitor scrolls towards it, which saves data and speeds up the first load.
All major browsers support native lazy loading with the loading="lazy" attribute on <img> and <iframe> elements. Older approaches use JavaScript, ideally the IntersectionObserver API, to swap in the real image source when an element comes into view.
Why lazy loading matters for SEO
Done well, lazy loading improves page speed by letting the browser focus on what is visible first. Done badly, it hurts in two ways.
First, lazy loading the main image at the top of the page delays Largest Contentful Paint, because the browser waits before fetching it. Second, Googlebot does not scroll. Google renders pages with a tall viewport, so content set to load when it enters the viewport usually loads, but content that only appears after a scroll event, a click or a “load more” button may never be seen. JavaScript implementations that rely on scroll events, rather than native lazy loading or IntersectionObserver, are the most likely to fail.
How to lazy load images for SEO
- Use native loading="lazy" on images and iframes below the fold.
- Do not lazy-load images in the first screen, especially the LCP image; give that one fetchpriority="high" instead.
- Keep the real image URL in the src (or srcset) attribute so crawlers can find it, rather than hiding it in a data attribute only a script reads.
- Set width and height on lazy images to avoid layout shifts.
- For content lists, back infinite scroll with paginated URLs that crawlers can reach.
- Check the rendered HTML in Search Console’s URL Inspection tool to confirm the images and content appear.
Lazy loading example
<!-- Hero image: load straight away -->
<img src="/img/hero.webp" width="1200" height="600" fetchpriority="high" alt="Runner on a trail">
<!-- Further down the page: lazy-load -->
<img src="/img/gallery-4.webp" width="800" height="600" loading="lazy" alt="Shoe sole close-up">Lazy loading FAQ
Is lazy loading bad for SEO?
No, if you use native lazy loading or IntersectionObserver and keep it off images at the top of the page. It becomes a problem when it delays the LCP image or hides content behind scrolling or clicks.
Can Google see lazy-loaded images?
Yes, when the image URL is in the src or srcset attribute and loading happens as elements enter the viewport. Google renders pages with a tall viewport rather than scrolling.
Related SEO terms
Largest Contentful Paint (LCP)
Largest Contentful Paint (LCP) is a Core Web Vital that measures when the largest image or text block in the viewport appears. Good is 2.5 seconds or less.
Page speed is how quickly a page loads, shows its content and responds to input. Google measures it mainly through Core Web Vitals.
Image SEO is optimising images so they load fast, are understood by search engines and can rank in Google Images and image results.
JavaScript SEO is the work of making sure search engines can crawl, render and index content and links that a site builds with JavaScript.
Cumulative Layout Shift (CLS) is a Core Web Vital that measures how much content moves unexpectedly while a page is used. Good is 0.1 or less.
Pagination splits a long list of items, such as products or articles, across a series of numbered pages, each with its own URL.