Newwebs Techs logo Newwebs TechsBuilding websites, explained for beginners
Performance

How to Lazy Load Images the Right Way on a Small Site

Your homepage has twenty photos, the page takes four seconds to show anything on a phone, and PageSpeed Insights keeps telling you to "defer offscreen images".

Laptop on a desk showing browser developer tools with a network panel listing images loading as the page scrolls

Your homepage has twenty photos, the page takes four seconds to show anything on a phone, and PageSpeed Insights keeps telling you to "defer offscreen images". Learning to lazy load images is one of the cheapest speed fixes there is, but done carelessly it can make your most important image load later and your scores worse.

I look after hosting and speed for a handful of small business sites, and this is the exact approach I use. It takes about 15 minutes on a typical site and needs no plugin for most setups.

What it means to lazy load images

By default, a browser downloads every image on a page as soon as it reads the HTML, even images at the very bottom that the visitor may never scroll to. Lazy loading tells the browser to wait and fetch an image only when it gets close to the visible part of the screen.

On a long page, that can cut the initial download dramatically. A blog post with 15 photos at 150 KB each starts with about 2.25 MB of images. If only two are visible on arrival, lazy loading brings that first download down to around 300 KB. On a slow mobile connection, that is the difference between a page that appears in one second and one that appears in three.

It also saves your visitors' data and your hosting bandwidth, since images below the fold are never downloaded by people who leave early.

The native way to lazy load images

Modern browsers, including Chrome, Edge, Firefox and Safari, support lazy loading natively. You add one attribute to each image tag: the loading attribute with the value lazy. That is it. No JavaScript library, no plugin.

A few details make it work properly:

  • Always set width and height. Give each image its real width and height attributes so the browser reserves space before the file arrives. Without them, the page jumps as images load, which hurts your layout shift score. Our guide on fixing cumulative layout shift explains why this matters.
  • Use it on images, iframes and embedded videos. The same attribute works on iframes, which is useful for maps and video embeds that are often the heaviest items on a page.
  • Do not lazy load background images set in CSS. The attribute only affects image and iframe tags. CSS backgrounds need a different technique.

Most current content systems add the attribute for you. WordPress has applied it automatically to content images since version 5.5, and many site builders do the same. Check your page source to confirm before adding anything by hand.

The image you must never lazy load

This is where most sites go wrong. The largest image visible when the page first opens, usually a hero banner or the top photo of a post, is very often the element that decides your Largest Contentful Paint score. LCP measures how long it takes for that main element to appear, and Google treats under 2.5 seconds as good.

If you lazy load that hero image, the browser deliberately waits before fetching it. I have seen LCP get worse by 0.5 to 1.5 seconds on small sites after someone switched on a "lazy load everything" setting.

For the first one or two images that appear above the fold:

  1. Remove the lazy loading attribute, or set it to eager.
  2. Add the fetchpriority attribute with the value high to the single most important image.
  3. Make sure that image is properly compressed and sized for the screen.

Everything further down the page can be lazy loaded safely.

Why I disagree with lazy loading plugins for small sites

A popular piece of advice is to install a dedicated lazy loading plugin or script. For older sites in 2016 that made sense. Today, for most small sites, I think it does more harm than good.

Many of these scripts replace the real image address with a placeholder and swap it back in with JavaScript. That means the browser cannot find the image until the script has downloaded and run, which adds delay to every image, including the ones you wanted quickly. If JavaScript fails or is slow, images may not show at all. Search engines are better at handling this than they used to be, but there is no reason to take the risk.

Native lazy loading is built into the browser, starts working before any script runs, and costs nothing in page weight. Unless you need a special effect such as a blurred preview, skip the plugin. If you already have one installed, test your site with it switched off. In my experience the page usually gets faster.

How to test that it is working

You do not need special tools. Here is a quick check that takes five minutes:

  1. Open your page in Chrome and press F12 to open developer tools.
  2. Go to the Network tab, tick "Disable cache" and choose the Img filter.
  3. Reload the page without scrolling. You should see only the images near the top load.
  4. Scroll down slowly. New images should appear in the list as you approach them.

Then run the page through PageSpeed Insights. The warning about offscreen images should disappear, and the LCP element shown in the report should not be marked as lazy loaded. If the score barely moves, look at the opportunities list in the same report, since slow hosting or heavy scripts may be the bigger problem.

Lazy loading is not a substitute for smaller images

Lazy loading delays downloads. It does not make images lighter. A 3 MB photo that loads lazily is still 3 MB when the visitor scrolls to it, and on a phone they will watch it slowly fill in.

Before you worry about loading order, resize images to the largest size they actually display at, usually no more than 1600 pixels wide for full width photos, and compress them to modern formats like WebP. The steps in compressing images for a faster website pair perfectly with lazy loading. Together they often cut total image weight by 70 percent or more.

Frequently asked questions

Does lazy loading images help SEO?

Indirectly, yes. Lazy loading reduces initial page weight, which can improve load speed and Core Web Vitals, both of which feed into how Google judges page experience. It only helps if you avoid lazy loading the main above the fold image, which would hurt LCP instead.

Should I lazy load all images on my website?

No. Lazy load images below the fold, but load the first one or two visible images normally. The main hero image should load as early as possible, ideally with high fetch priority.

Do all browsers support native lazy loading?

All major current browsers support the loading attribute on images, including Chrome, Edge, Firefox and Safari. Older browsers that do not support it simply ignore the attribute and load images normally, so nothing breaks.

FN
Felix Nkemelu

Felix covers website speed and hosting for beginners, turning technical topics into practical decisions.

More posts by Felix

More in Performance

01doorganico 084goad 3hot8 4465456 after5internprogram ahandfulofblessings ahmadpc ahomcybersecurity allodialresources annodex antiquesandperiodcollectibles aotc asianworldkashmir beedlectrics bloggertemplatefree bluefeatheragency bodyweightsolution campaign08blog carfixadvisor catstreetcollective cbstvsports cnfanspurchasing committeeof500yearsofdignityandresistance covertopsdjs cs-kaiyuangame cuestacomunicaciontotal cxoutlet dancebetgame deskgearhub destinyvillastay detectmagazine di33 diamondsteelbuildings donmo dyanadropship emarsysfinance emimattl escapechan eskitarih evautoplay everythingweddings-orlando farmzone feedviewerapp foxstudiosscratch gamevui123 gleasongrade greetingsday hacklabasu haskell iw-kaiyun jagoanproperti jilidskripsi joltbusinessfinance juegodepokergratis juegospucca kaeru-festival latestmehndidesigns lestanzediottaviano litemagazines localcommunityhero lustrsazan mariashebets menswheels nikkit ootheday oxigenvpn plurfitness prefetial probudgetcarpetcleaning psychicmrsmartin pyaten qvantor rejoignezlogis rexzbot riselayouts ruchin rwxqsgd5 sakaltime shibiaowang shop-bot skrtips spotlesshaven strcoding tetapatrium topselller uneplanteartificielle vipertechcr webtech1223411 wo-kygaming yamaha-mekar yeknava yoybuysheets zenunwa yamaha-mekar jilidskripsi ankertoto ankertoto ankertoto