Skip to content
Performance & Accessibility

How to Get Lazy Loading Images Right

Deferring the download of images until they are about to scroll into view, using the loading="lazy" attribute or a script.

Marcus Adeyemi Technical Director 2 min read 18 views
How to Get Lazy Loading Images Right

Where most projects go wrong

The usual mistakes:

  • Lazy loading every image including the hero
  • Images without dimensions that shift the layout
  • Heavy lazy-loading libraries where native works
  • Lazy loading images that search engines need but cannot trigger

What good looks like instead

  • Lazy load images below the first screen
  • Load the LCP image eagerly with high priority
  • Set width and height on every image
  • Use native lazy loading before script libraries
  • Check behavior on long pages and carousels
What to do and what to avoid with lazy loading images, side by side
Good practice against the usual mistakes, from the sources listed below.

Why it matters

Lazy loading saves bandwidth and speeds up initial loading, but applied to the wrong image it delays the largest element and makes pages slower.

The specs that matter

Published figures for Lazy Loading Images
MeasureFigure
Native attributeloading="lazy" on img and iframe elements
Browser supportsupported in all major browsers
Largest Contentful Paintthe main above-the-fold image should not be lazy loaded
Dimensionswidth and height attributes prevent layout shift as images load

Knowing when to hand it over

Tip: Bring in help when LCP worsened after adding lazy loading, or when image-heavy pages load slowly.

Where this comes from

The figures and practices above come from the sources listed.

Working on something like this?

We take on Performance & Accessibility work for teams who want it done once, properly. Tell us what you are building and we will tell you honestly whether we are the right studio for it. Start a project.

Where to go next

Spotted something wrong? Report an error on this page. We correct on the page and say what changed.

All services

The work behind this article, and what it costs.

Marcus Adeyemi

Builds and maintains the web work. Writes about front-end architecture, performance, accessibility and the unglamorous parts of keeping a site alive.

Keep reading

More in Performance & Accessibility