How to Fix Missing Alt Text on Lazy-Loaded Images
Some lazy-loading setups replace a placeholder with a new <img> element, or render images from data-src attributes, and the alt attribute gets lost along the way. The result is that screen readers and search engines see images with no description. By the end of this guide, every lazy-loaded image on your site will keep its alt attribute in the final rendered DOM.

Why it matters
Screen readers announce an image without alt by reading its file name, such as "IMG_4821 dot webp", or skip it with no context. Google Images and AI answer engines use alt text to understand what a picture shows, so a missing alt removes a relevance signal for product and editorial images. The fix usually takes minutes, and it also helps you meet WCAG 2.2 success criterion 1.1.1 (Non-text Content).
What you need
Step-by-step fix
List lazy images missing alt on a flagged page
Open a flagged page, scroll to the bottom so every image loads, then open DevTools (F12) > Console. Paste the snippet below. It lists every lazy-loaded image (native loading="lazy", data-src/data-srcset, or a lazy class) that has no alt attribute in the rendered DOM.
View Source is not enough, because scripts change the markup after load.
[...document.querySelectorAll('img')].filter(i => (i.loading === 'lazy' || i.dataset.src || i.dataset.srcset || /lazy/i.test(i.className)) && !i.hasAttribute('alt')).forEach(i => console.log(i.currentSrc || i.dataset.src, i));Identify what is doing the lazy loading
Click one of the logged images and check its attributes in the Elements panel. Common culprits:
- Classes such as
lazyload,lazy,lozadorb-lazypoint to a JavaScript library (lazysizes, lozad.js, vanilla-lazyload). data-lazy-srcordata-ll-statususually comes from a WordPress optimization plugin.- A
<noscript>sibling containing the real<img>means the theme outputs two copies of the image, and only one may have alt.
Note the plugin or theme file name so you know where to make the fix.
Switch to native lazy loading where possible
All current browsers support loading="lazy", so most sites no longer need a JavaScript library. Native lazy loading never touches attributes, so alt is kept automatically. Remove the library class and data-src, put the real URL in src, and add width and height to prevent layout shift.
Do not lazy-load the main above-the-fold image, because that delays Largest Contentful Paint.
<!-- Before --> <img class="lazyload" data-src="/img/blue-mug.webp" src="/img/placeholder.gif"> <!-- After --> <img src="/img/blue-mug.webp" alt="Blue ceramic Example Co coffee mug, 350 ml" loading="lazy" decoding="async" width="800" height="800">
If you keep a JS library, put alt on the source markup
Libraries like lazysizes only swap data-src into src. They keep any alt that already exists, but they cannot invent one. Make sure the template outputs alt on the placeholder <img> itself, not only inside a <noscript> fallback.
If you use <picture>, alt belongs on the inner <img>, never on <source>.
<picture> <source type="image/avif" data-srcset="/img/blue-mug.avif"> <img class="lazyload" data-src="/img/blue-mug.webp" alt="Blue ceramic Example Co coffee mug, 350 ml" width="800" height="800"> </picture>
Fix custom scripts that rebuild the <img>
Hand-written lazy loaders often create a new image with document.createElement('img') and copy only the src. Copy alt as well, along with width, height and sizes. The simpler and safer approach is to change attributes on the existing element instead of replacing it.
const io = new IntersectionObserver(entries => {
entries.forEach(e => {
if (!e.isIntersecting) return;
const img = e.target;
// Update the existing element so alt, width and height stay intact
if (img.dataset.srcset) img.srcset = img.dataset.srcset;
img.src = img.dataset.src;
img.removeAttribute('data-src');
io.unobserve(img);
});
});
document.querySelectorAll('img[data-src]').forEach(img => io.observe(img));Write the alt text and mark decorative images
Fill in the actual descriptions in your CMS media fields so the templates have something to output. Describe what the image shows in context, in about 5 to 15 words. For purely decorative images such as dividers or background flourishes, use an empty alt="".
An empty alt counts as present, and it tells screen readers to skip the image.
<img src="/img/divider.svg" alt="" loading="lazy" width="1200" height="24">
Clear caches and re-test the flagged pages
Purge your page cache, CDN cache and any optimization plugin cache. Then reload each flagged page, scroll to the bottom, and rerun the console snippet from step 1. It should log nothing.
Finally, rerun the audit to confirm that the number of flagged pages drops to zero.
Platform-specific notes
WordPress
Core adds loading="lazy" automatically and keeps alt. Problems usually come from optimization plugins (WP Rocket, Smush, a3 Lazy Load, LiteSpeed Cache). Try disabling their image lazy-load option, for example WP Rocket > Media > LazyLoad, and rely on core instead. Set alt under Media > Library > attachment > Alternative Text. Images already inserted in posts keep their old alt, so update them in the block editor's Image block > Alternative text field.
Shopify
Older themes use lazysizes with data-src. In Online Store > Themes > Edit code, replace hand-built <img> tags with {{ image | image_url: width: 800 | image_tag: loading: 'lazy', alt: image.alt }}. Add the alt text itself under Products > select product > click the media > Add alt text.
Wix
Wix lazy-loads images automatically, and you cannot change the script. Add alt via the image's Settings > "What's in the image? Tell Google" field. In Wix Stores, set it in the product media settings. Images left without this field render with no meaningful alt.
Webflow
Select the image > Image Settings and set Load to Lazy, which uses native loading. Set alt in the Assets panel (gear icon > Alt text) or override it per instance in Image Settings. Choose "Decorative" for images that should have alt="".
Next.js
next/image lazy-loads by default and requires the alt prop. Problems arise when a component passes alt={undefined} from missing CMS data. Default it with alt={image.alt ?? ''}, and fill in the CMS field instead of leaving it empty.
Check that it worked
✅ How to verify
- Rerun the console snippet after scrolling to the bottom of each flagged page and confirm that it logs no images.
- In DevTools > Elements, inspect a loaded lazy image and confirm the alt attribute is present after the src swap.
- Use Lighthouse (DevTools > Lighthouse > Accessibility) and check that the "Image elements have [alt] attributes" audit passes.
- Rerun the site audit and confirm that the flagged page count for this check is zero.
⚠️ Common mistakes
- Checking View Source instead of the rendered DOM, so alt appears to exist but the script removes it at runtime.
- Adding alt only to the <noscript> fallback image while the visible lazy <img> has none.
- Putting alt on <source> or <picture> instead of the inner <img>.
- Forgetting to purge CDN and plugin caches, so the old markup keeps being served after the fix.
Is this still an issue on your site? Run a free audit — ZORO checks this and 294 other SEO, AI-visibility, accessibility and security signals, with fixes for your platform.
Check my site freeFAQ
Does lazy loading hurt image SEO?
No, as long as the final <img> has a real src, alt text and width/height. Google renders JavaScript and supports native loading="lazy". The risk comes from scripts that drop alt or never set src for crawlers.
Is an empty alt="" OK for lazy-loaded images?
Yes, for decorative images. An empty alt is a valid attribute that tells assistive technology to skip the image. Images that carry meaning, such as product photos, charts or people, need descriptive text.
Do I still need a lazy-load JavaScript library in 2026?
Rarely. Native loading="lazy" works in all major browsers for images and iframes. A library is only worth keeping for special effects such as blur-up placeholders, and even then it should modify the existing <img> rather than replace it.
Why does my image have alt in the CMS but not on the page?
Either the theme template does not output the alt field, or a lazy-load or optimization plugin rebuilds the <img> without copying it. Inspect the rendered element and check the template or plugin settings.
How to Fix Multiple Meta Description Tags on a Page
How to Fix an Obsolete Meta Keywords Tag on Your Site
How to Fix Empty Anchor Links and Icon-Only Links
How to Fix Missing Brand Name in Page Titles
How to Fix Over-Optimised Footer Links on Your Website
How to Fix Click Depth Greater Than 3 on Your Website