Largest Contentful Paint (LCP) measures how long it takes for the largest image or block of text in the visible part of a page to appear. Google counts 2.5 seconds or less, for at least 75% of visits, as good. On most pages the largest element is an image, usually a hero photo or the main product picture, which makes this one of the more fixable Core Web Vitals.
First, find the LCP element
Run the page through PageSpeed Insights. The report names the LCP element and splits its time into four parts:
- Time to first byte: how long the server takes to start sending the page.
- Load delay: the gap before the browser starts downloading the image.
- Load duration: how long the download takes.
- Render delay: the gap between the download finishing and the image appearing.
The largest of the four tells you which section below to start with. Check the mobile result too, because the LCP element is often a different one there.
Let the browser find the image early
These reduce load delay.
- Put the image in the HTML as an
imgelement. The browser spots these while it is still reading the page. An image set as a CSS background, or added by JavaScript, is found much later. - Do not lazy-load it. Remove
loading="lazy"from the LCP image. Lazy loading is for images below the fold. On the main image it only adds delay. Check that a plugin or theme is not adding it for you. - Raise its priority. Add
fetchpriority="high"so it is downloaded ahead of the page's other images. - Preload it if it cannot be an
img. For a CSS background image, add a hint in theheadof the page:
<link rel="preload" as="image" href="/img/hero.webp" fetchpriority="high">
Make the file smaller
These reduce load duration.
- Resize it. The file should be no wider than about twice the width it is displayed at.
- Use a modern format. WebP or AVIF in place of JPEG or PNG.
- Compress it. Compare with the original and use the lowest quality at which you cannot see a difference.
- Send each screen the right size. Use
srcsetandsizesso that phones do not download the desktop version.
Put together, a well set up hero image looks like this:
<img src="hero-1200.webp"
srcset="hero-600.webp 600w, hero-1200.webp 1200w, hero-2000.webp 2000w"
sizes="100vw"
fetchpriority="high"
alt="Bakery counter with fresh bread" width="1200" height="600">
Shorten the wait for the server
These reduce time to first byte, which delays everything that follows.
- Cache pages, so the server does not build each one from scratch for every visitor.
- Avoid redirects on the way to the page and to the image. Each one costs a round trip.
- Serve the image from the same host as the page, or from a CDN. If it has to come from another host, add
<link rel="preconnect">for that host so the connection is opened early.
Remove whatever keeps the image hidden
These reduce render delay.
- Sliders and carousels that build the first slide with JavaScript. Put the first slide in the HTML.
- Entrance animations. An image that starts invisible and fades in does not count until it can be seen.
- Blocking stylesheets and scripts in the
head. Nothing is drawn until they have loaded. Keep the essential CSS small and defer scripts that are not needed at once. - Testing and consent scripts that hide the whole page until they are ready.
Check the result
Run PageSpeed Insights again and compare the four parts. The lab figures change straight away. The field data at the top of the report comes from real Chrome users over the previous 28 days, so it takes weeks to catch up with a fix.
Start with the file
Of everything here, shrinking the image is usually the quickest to do. SquishPixel compresses and converts it in your browser and shows the result next to the original, so you can pick the smallest version that still looks right.