Performance 6 min read

Lazy loading explained: faster pages without broken images

Lazy loading delays off-screen images until they’re needed. Used well, pages load faster.

On this page 10 sections

A typical business web page contains far more images than fit on the first screen: project photos, team pictures, logos, icons and illustrations further down the page. Without lazy loading, the browser downloads all of them as soon as the page opens, even the ones a visitor may never scroll to.

Lazy loading tells the browser to wait. Images and embeds below the visible area are loaded only as the visitor scrolls towards them. It is one of the simplest ways to make pages lighter and faster, especially on phones. It can also slow a page down if it’s applied to the wrong images. This guide explains how lazy loading works, where to use it and the mistakes to avoid.

The short answer

  • Lazy loading delays loading images, videos and embeds until they are about to appear on screen.
  • It saves data and speeds up the first view of the page, because the browser focuses on what the visitor sees first.
  • Modern browsers support it natively with the loading="lazy" attribute on images and iframes.
  • Never lazy-load the main image at the top of the page. It delays the most important content and harms Largest Contentful Paint.
  • Give lazy-loaded images a width and height, so the layout doesn’t jump when they appear.

How lazy loading works

Normally, a browser reads a page’s HTML and starts downloading every image it finds. With lazy loading, the browser downloads images near the visible area straight away, and waits for the others until the visitor scrolls close to them. Browsers start loading a little before an image comes into view, so in most cases visitors never see a gap.

Today, lazy loading is built into browsers. Adding loading="lazy" to an image or iframe is enough. Older websites often used JavaScript libraries to do the same job, which added extra code and sometimes caused problems for search engines. Google’s web.dev guide to browser-level lazy loading explains the attribute and how browsers decide when to load.

What to lazy-load and what not to

Content Lazy-load? Why
The main image or banner at the top No It is usually the largest element on the first screen
Your logo in the header No It’s visible immediately
Images further down the page Yes Most visitors don’t see them straight away
Project galleries and photo grids Yes They are often heavy and below the first screen
Embedded maps and videos Yes Embeds load a lot of extra code
Images in a carousel after the first slide Usually yes They aren’t visible until the visitor moves the carousel

The biggest mistake: lazy-loading the hero image

Largest Contentful Paint (LCP) measures how long it takes for the biggest piece of content on the first screen to appear. On most pages that is the hero image. If it’s lazy-loaded, the browser waits until it has worked out the layout before requesting it, which delays the moment visitors see the page properly.

Google’s guidance on the effect of lazy loading on LCP found that lazy-loading images at the top of the page tends to make LCP worse. Load the main image normally, and consider marking it as high priority with fetchpriority="high". Our guide to Core Web Vitals explains LCP and the other measures in more detail.

Other common mistakes

  • Missing width and height. Without them, the browser doesn’t know how much space to reserve, and content jumps as images load. This harms Cumulative Layout Shift (CLS).
  • Lazy-loading everything. Some plugins apply lazy loading to every image by default, including the logo and hero image. Check which images are excluded.
  • Two lazy-loading systems at once. A theme, a speed plugin and the browser can all try to lazy-load the same images, causing flickering or images that never appear.
  • Images that depend on JavaScript to show. If the script fails, visitors and search engines see empty spaces. Native lazy loading avoids this.
  • Background images in CSS. The loading attribute only works on images and iframes in the HTML. Large decorative backgrounds need a different approach, or a regular image instead.

Lazy loading videos, maps and other embeds

Embedded YouTube videos, maps and social media posts often load hundreds of kilobytes of code, even if nobody presses play. Two approaches help:

  1. Lazy-load the iframe with loading="lazy", so it loads only when the visitor scrolls near it.
  2. Use a lightweight preview. Show a thumbnail image with a play button, and load the real player only when the visitor clicks it.

The second approach saves the most, and it is worth using for any video that sits in the middle of an important page. Our guide to adding video without slowing your website covers it in more detail.

Lazy loading on WordPress

WordPress adds loading="lazy" to images automatically and tries to skip the first images on the page. Results depend on your theme and page builder, so check what actually happens:

  1. Open a page, view the source, and find the hero image. It shouldn’t have loading="lazy".
  2. Check that images further down do have it.
  3. If you use a speed plugin, review its lazy-loading settings and exclude the logo and hero image.

Our guide to speeding up a WordPress website covers the other settings worth checking at the same time.

How to check lazy loading is working

  • PageSpeed Insights warns when the LCP image is lazy-loaded, and lists off-screen images that could be deferred. Our guide to reading PageSpeed Insights shows where to look.
  • Your browser’s developer tools show which images load before you scroll. On the Network tab, filter by images, reload the page and watch new requests appear as you scroll down.
  • A slow connection test. Throttle the network in developer tools and scroll quickly through the page. Images should appear just before you reach them, without large gaps.

Frequently asked questions

Does lazy loading affect SEO?

Native lazy loading with the loading attribute is fine for search engines: Google can see and index those images. Problems arise mainly with older JavaScript methods that hide the image address until the page is scrolled.

Should I lazy-load images on a short page?

If every image is visible on the first screen, lazy loading adds nothing. On short pages with one or two images further down, it saves a little data but makes little difference. It matters most on long pages with many images.

Is lazy loading the same as image compression?

No. Compression makes each image file smaller, while lazy loading changes when images are downloaded. They work best together. Our image optimisation guide covers formats, sizes and compression.

What to do next

Run your three most important pages through PageSpeed Insights. Check whether the LCP image is lazy-loaded, whether images have dimensions, and whether any heavy embeds load before anyone scrolls to them. Fix the hero image first, because it makes the biggest difference.

If your pages are still slow after these fixes, the cause is often deeper: the theme, too many plugins or the hosting. Our website maintenance care plans include ongoing speed work on the Growth plan, and our website redesign service rebuilds slow sites around fast loading from the start.

Written by the PORVIX team

The people who design, build and maintain websites for growing businesses. We write about the questions that come up on real projects, in plain language, and update articles when the advice changes.

Published

How we work

Is your current site costing you enquiries?

A free, plain-language audit, by email within 2 business days.

Get a free audit
Get a free audit

Keep reading

More plain-language guides.

More on performance first, then other guides worth reading next.

All insights

Start here

Let’s build a website that brings in business.

Tell us about your project. You’ll hear back from a real person within one business day, with honest advice either way.

  • Free consultation
  • Fixed written quote
  • Your details stay private