Guide Speed & Performance

How to improve Largest Contentful Paint

How to find the specific element dragging down your LCP score, and the fixes that actually move it.

Updated 9 min read Intermediate

Largest Contentful Paint measures how long it takes for the biggest visible element on the page to finish rendering — usually a hero image, a large heading, or a block of text. Google's published threshold for a good score is under 2.5 seconds. Improving it starts with finding out exactly which element is being measured, because the fix is completely different depending on whether that element is an image, a web font, or something being held up by a slow server response.

Find the LCP element first

Do not guess. Most speed testing tools that report Core Web Vitals will identify the specific element they measured as the "LCP element" — often with a screenshot or an outline showing exactly what it is. This is the single most useful piece of information in the whole report, because it tells you which of the fixes below actually applies.

The LCP element is not always what you expect

It is whichever element is largest by rendered area at the point the browser finishes painting it — sometimes a background image set in CSS rather than the obvious hero photo, sometimes a block of body text rather than an image at all. Check what the tool actually identified before changing anything.

If the LCP element is an image

This is the most common case, and there is a specific order of fixes worth working through:

  • Compress it properly. A hero image exported at full camera resolution and default quality is the single most common cause of a poor LCP score. See compressing images for the web for the full process.
  • Serve it at the size it is actually displayed at. An image does not need to be 4000 pixels wide to fill a 1200-pixel banner. Resize before uploading, or use responsive srcset markup so the browser can choose an appropriately sized version.
  • Never lazy-load the LCP image. loading="lazy" is the right attribute for images further down the page, but applying it to the image the browser needs to paint first actively delays LCP — it tells the browser to wait until it is needed, which for this specific image is immediately.
  • Add fetchpriority="high" to it instead. This attribute tells the browser to fetch this specific image ahead of other resources competing for bandwidth, which is exactly what the LCP image needs.
  • Set width and height attributes. This does not speed up the image itself, but it lets the browser reserve the right amount of space before the image arrives, which also helps layout shift at the same time.
<img src="hero.webp" width="1200" height="600"
     fetchpriority="high" alt="...">
Do not lazy-load anything above the fold

Lazy loading is a genuinely good default for images the visitor has to scroll to see. Applied to the image at the top of the page, it does the opposite of what you want — it is a direct instruction to the browser to deprioritise the exact thing LCP is measuring.

If the LCP element is text

A large heading or block of text can be the LCP element, and in that case the usual culprit is a web font. If the page uses a custom font and that font has not loaded yet, the browser either shows invisible text until it has (which delays LCP directly) or swaps in a fallback font first (which can shift layout when the real font arrives). How to stop web fonts slowing your page covers preloading the font file and setting font-display correctly, both of which apply directly here.

If nothing renders quickly at all

When LCP is poor across the whole site regardless of what the largest element happens to be, look upstream of the page's content entirely. Every millisecond spent waiting for the server to respond is a millisecond added to every metric that follows, including LCP — nothing can render before the browser has received the page. Check Time to First Byte specifically, and rule out a slow database query, an uncached dynamic page, or a plugin doing unnecessary work on every request before assuming the front-end is at fault.

Requests that compete with the LCP image

Even a well-optimised image can be delayed if the browser is busy fetching render-blocking CSS or JavaScript first. Two things help here:

  • Preload the LCP image with a <link rel="preload"> tag in the page head, which tells the browser to start fetching it immediately rather than discovering it only once it has parsed further into the HTML.
  • Reduce what blocks rendering before it. Minifying and deferring scripts that are not needed immediately means the browser spends less time on them before it gets to painting the page's content.
<link rel="preload" as="image" href="hero.webp">

Check it actually moved

Change one thing, then re-test

Compressing the image, adding fetchpriority, and preloading it all at once means you cannot tell which change did the work. Make one change, re-run a proper speed test, and confirm the LCP figure actually moved before assuming it did.

A useful order to work through, in practice: identify the LCP element, fix it directly using whichever section above applies, check TTFB is not adding delay before the element even starts loading, then remove anything competing with it for bandwidth. Most sites see the biggest single improvement from the first two steps — the image itself is usually where the time is going.

Summary

LCP element isFix
An oversized or uncompressed imageCompress, resize, and serve in a modern format
Correctly sized but loading lateAdd fetchpriority="high", preload it, remove loading="lazy"
A block of textFix web font loading — preload the font, set font-display
Slow across every page, regardless of contentInvestigate server response time and caching, not the front end

If the server response itself turns out to be the bottleneck, does hosting actually affect site speed covers how to tell, and when it is genuinely time to look at the account rather than the page.

Related reading