How do I lazy-load images?
Last checked 31 Aug 2026
Short answer
Ask Lovable to add native lazy-loading to images below the fold while keeping the hero/first-visible image loading eagerly, so visitors aren't downloading offscreen images before they're needed.
What lazy-loading does
Lazy-loading defers downloading an image until it's about to scroll into view, instead of loading every image on the page immediately. It reduces initial page weight and speeds up load for what's actually visible.
What to lazy-load, and what not to
- Lazy-load: images further down a long page — galleries, blog post images, footer content, secondary product photos.
- Don't lazy-load: the first visible hero image or anything above the fold — that's usually the LCP element, and lazy-loading it works against Core Web Vitals rather than for it.
How to ask Lovable
Add lazy-loading to images that appear below the fold across the site, but make sure the main hero image on each page still loads immediately.
Lovable can implement this with the standard HTML loading="lazy" attribute or an equivalent React pattern, depending on how images are rendered in the codebase.
Confirming it worked
Open DevTools → Network tab, reload the page, and check that offscreen images only start downloading as you scroll toward them rather than all at once on load.
What usually goes wrong
- Lazy-loading everything indiscriminately, including the hero image, which then delays the metric (LCP) it was supposed to help.
- Assuming lazy-loading alone fixes slow images — a lazy-loaded but still uncompressed 5MB image is still slow once it loads. Combine lazy-loading with compression and correct sizing.
- Images loaded via CSS
background-imagedon't support native lazy-loading the same way — these need a different approach (e.g. loading them via JavaScript on scroll), so flag these separately when asking Lovable.
See /questions/how-do-i-optimise-images for the full image checklist.
Sources
Was this answer helpful?
Related questions
- AnswerWhy is my database making so many requests?Usually a component is re-fetching data on every render, a page is running the same query multiple times, or you're fetching entire tables instead of what's actually needed — ask Lovable to audit data-fetching patterns.
- AnswerHow do I improve Core Web Vitals?Focus on the three metrics Google measures — LCP (loading), INP (interactivity), and CLS (visual stability) — and fix the specific one flagged as poor, usually starting with images for LCP.
- AnswerHow do I remove unused code?Ask Lovable to search for unused components, imports and dependencies, or run a tool like ts-prune/depcheck via the terminal, then remove what's confirmed unused and re-test.
- AnswerHow do I reduce unnecessary database calls?Fetch only what a page needs, cache results, batch requests, and let Postgres do filtering instead of pulling whole tables into the client.