DEV Community

Cover image for Never lazy-load your LCP image: the fetchpriority, preload and srcset checklist
Sahadat Husain
Sahadat Husain

Posted on

Never lazy-load your LCP image: the fetchpriority, preload and srcset checklist

A Core Web Vitals tip: never lazy-load the image that decides your LCP (Largest Contentful Paint). Give it fetchpriority="high", leave loading out, and add a preload only when the HTML can't show the image.

The 2025 Web Almanac still finds 16–17% of pages lazy-loading their LCP image. Only 17% of mobile pages with an image LCP use fetchpriority="high".

What each attribute actually does

  • loading="lazy": the download waits for layout. On a hero, that wait is pure delay.
  • loading="eager": the default. Writing it changes nothing.
  • fetchpriority="high": the request starts at High instead of Low. Google Flights went from 2.6 s to 1.9 s LCP with it (web.dev).
  • lazy + high: still waits for layout. The delay stays.

When you need a preload

Only when the preload scanner can't see the image:

  • a CSS background-image hero
  • an image a script inserts
  • a JS-built slider

Put fetchpriority="high" on the preload too. Match imagesrcset and imagesizes to the element exactly, or the browser downloads twice.

Then cut the bytes

Same hero photo, 1920 px wide, our engine at Auto quality:

  • JPEG: 140.3 KB
  • WebP: 85.5 KB
  • AVIF: 69.3 KB

A phone that shows the hero at 400 CSS px on a 2x screen needs 800 px. That file is 35.2 KB. srcset + a real sizes value gets it there. Note that sizes="auto" only works with lazy images, so your LCP image needs a real value.

Which fix shortens which part of LCP

The markup

<img
  src="/img/hero-1280.jpg"
  srcset="/img/hero-800.jpg 800w, /img/hero-1280.jpg 1280w, /img/hero-1920.jpg 1920w"
  sizes="100vw"
  width="1920" height="1076"
  alt="..."
  fetchpriority="high">
Enter fullscreen mode Exit fullscreen mode

Wrap it in <picture> with an AVIF <source> first, then WebP.

What does your LCP breakdown look like? I'm curious which sub-part hurts most on real sites: load delay or load duration.

Full write-up with every byte count: https://blinkimg.com/blog/image-optimization?utm_source=devto&utm_medium=social&utm_campaign=lcp-checklist

Top comments (1)

Collapse
 
sss_ec8db2b6aa43a4e969595 profile image
sss •

On our blog posts it was mostly load duration, and both causes were invisible in the page's own markup.

  1. A srcset that lied about a width. We listed two variants as 960w and 1200w, but the "1200w" file was the original, which is really about 1600 px wide. A DPR-3 phone (390 CSS px slot, so roughly 1,100 px needed) picked it and pulled 250 KB for the LCP image instead of a 53 KB variant. iPhone 14 Pro and Galaxy S20 emulation both did this; DPR-2 devices didn't, which is why it hid for a while. On your markup: our hero sat inside page padding, so sizes="100vw" overstated the slot by 40 px, and that alone pushed selection up a rung at some widths.

  2. A prefetch stealing priority. A framework link prefetch on the breadcrumb loaded the blog index's payload, and that page marked its first three card images eager + fetchpriority="high". So every post view fetched about 107 KB of another page's images at High while its own hero waited. Nothing in the post's HTML showed it, only the network panel did. We cut the index to one priority image and turned prefetch off on those links.

Together that took mobile Lighthouse LCP from 4.7 s to 3.8 s on those posts. Two checks I'd add to the list: every w descriptor matches the file's real pixel width, and look at what else is requested at High before the LCP image.