Lazy Load Code Generator
Paste your HTML and get lazy-loaded images and iframes back, with the first images kept eager so your LCP does not suffer.
Native or JS modeLCP protectionLayout-shift warningsReady-to-paste
Drop an .html file or click to uploadHTML up to 8 MB, processed locally
or paste your HTML
Options
Updated HTML
Add before </body>
Why use this tool
Faster pages
Offscreen images and iframes stop competing with what the visitor sees first.
Protects LCP
The first images stay eager and can be prioritized, avoiding the classic lazy-loading mistake.
Spots layout shift
Flags images without width and height so you can prevent jumping content.
How it works
- Paste your HTML or drop a file.
- Choose native or JavaScript lazy loading and how many images stay eager.
- Copy the updated HTML, plus the script if you picked the fallback.
Frequently asked questions
Should I lazy load every image?
No. Never lazy load the main image visible on first load, especially your LCP image. It delays the most important paint.
Is native lazy loading enough?
Yes for modern browsers. loading="lazy" is supported in all current browsers. Use the JavaScript fallback only if you must support very old ones.
Why add width and height?
They let the browser reserve space before the image loads, preventing layout shift (CLS).
Does lazy loading affect SEO?
Googlebot supports native lazy loading and the Intersection Observer. Make sure lazy content has real src or data-src URLs in the HTML.
Can I lazy load videos and iframes?
Yes. Iframes support loading="lazy" natively, which is great for YouTube and map embeds.