What is LCP (Largest Contentful Paint) & How to Improve it?

LCP, short for Largest Contentful Paint, is one of the three Core Web Vitals, along with INP and CLS. It measures how long it takes for the largest text block or image to appear in the viewport, starting from the moment someone begins loading the page.

For a good user experience, aim for an LCP of less than 2.5 seconds for at least 75% of all page views.

An LCP lower than 2.5 seconds is considered good

Several factors affect how quickly a browser can render a webpage. A delay in any of them has a direct, significant effect on your LCP score.

Please note that it is rare for a quick fix in a specific part of a page to significantly change the LCP score. To improve this metric, you need to address the entire loading process of the page and ensure that you are optimizing every step of this process.

How to Identify the LCP Element

Before you can improve the LCP score, you need to find and isolate the element you’ll be working on.

You can find the LCP element for any page with Google’s speed testing tool. Enter the page URL and click “Analyze.”

How to identify and isolate the LCP element on a specific page

Once PageSpeed shows the results, scroll down to “Insights” and click “LCP breakdown“. Since Lighthouse 13, this insight has shown both the page’s LCP element and how much time each LCP subpart took:

PageSpeed Insights LCP breakdown insight showing the LCP element and its subpart timings

The LCP element might be a headline or a text block. In many cases, it’s an image.

I tested my site’s homepage for the example above. The LCP element is the <div class="subtitle"> element. You can see it highlighted in yellow in the thumbnail.

Because the LCP element here is a block of text, the breakdown shows only Time to first byte and Element render delay. There is no image to download, so the two resource subparts don’t apply.

When the LCP element is an image, you’ll see a related insight called “LCP request discovery“. It checks whether the browser can find the image in the initial HTML, whether the image is lazy loaded, and whether it has fetchpriority="high".
You can also identify the LCP element in the Chrome DevTools Performance panel. As soon as the page loads, the live metrics view shows both your local LCP and the element itself. If you record a trace, you’ll see the same “LCP breakdown” insight with the exact timing of each subpart.

Several Ways to Optimize the LCP Metric

To know how to improve the LCP score on your site, it is important to understand (more or less) how this metric is calculated. Here is a table that describes in percentages each of the factors that affect the LCP score:

LCP sub-part % of LCP
Time to first byte ~40%
Resource load delay <10%
Resource load duration ~40%
Element render delay <10%
TOTAL 100%

Let’s look at each factor in turn, starting with the ones that tend to matter most.

Although the Time to first byte has a significant impact on the LCP score, I will present it last. This is because website developers typically do not have much control over this metric.

1. Eliminate Resource Load Delay

To improve this factor, we must ensure that the LCP resource begins to load as early as possible. A rule of thumb in this case is to ensure that this resource starts loading at the same time as the first resource on the page.

The LCP resource can be either an image or a block of text using a web font.

If the LCP resource starts loading some time after the site’s first asset (First Resource) has loaded, there’s room for improvement. The two images below show the difference. In the first, there’s room to reduce the Resource Load Delay:

The image depicts a situation where the LCP element is loaded much after the first CSS file

The LCP resource loads long after the first CSS file (first resource)

What I aim for is a result as close as possible to the second image. Here, the LCP resource starts loading at the same time as the first file, which in this case is the marked CSS file:

The LCP element starts loading concurrently with the CSS file

The LCP resource starts loading at the same time as the CSS file

To load the LCP resource as quickly as possible, the browser needs to identify it immediately after the initial HTML response. In the image, that’s right after the blue line labeled Document.

For example, suppose the LCP element on your site is a block of text that uses a particular web font. The browser needs to discover and load that font as early as possible in the HTML Markup. To do that, preload the font in the site’s <head> with <link rel="preload">.

Take a look at the following post for more information on preloading assets using Preload assets in advance.

If the LCP element is an <img>, add fetchpriority="high" to the image element itself. That tells the browser to give the image priority over other resources:

<img src="/path/to/hero-image.webp" fetchpriority="high" alt="Hero image" width="1200" height="600">

Note that fetchpriority="high" is different from loading="eager". While loading="eager" is the default for images and simply means “don’t lazy load this”, fetchpriority="high" actively tells the browser to prioritize this resource earlier in the loading process.

If the LCP element uses a CSS background image, the browser won’t discover the image until it parses the stylesheet. To start the image download in parallel with the CSS, add a <link rel="preload"> hint:

<!-- Load the stylesheet that will reference the LCP image. -->
<link rel="stylesheet" href="/path/styles.css">

<!-- Preload the LCP image with a high fetchpriority so it starts loading with the stylesheet. -->
<link rel="preload" fetchpriority="high" as="image" href="/path/to/hero-image.webp" type="image/webp">

Be aware! Ensure that LCP images are never loaded lazily. Remove loading="lazy" from any image that is the LCP element.

One last tip: some images near the top of the screen load early even though the user won’t see them right away. Think of a carousel slide that isn’t visible yet. For those images, I recommend adding the fetchpriority="low" attribute to the <img> element.

2. Eliminate Element Render Delay

The goal here is for the browser to display the LCP element as soon as its resource finishes loading. When that doesn’t happen, the main reason is that something is blocking rendering. Here’s what I look for:

  • CSS files or non-asynchronous scripts in the page’s <head> block rendering.
  • The LCP resource has finished loading, but the LCP element isn’t in the DOM yet because the page is still waiting for some JavaScript code to load.
  • CSS or code hides the element, for example during A/B Testing or an entrance animation that starts at opacity: 0 (more on that below).
  • The main thread is blocked due to long JavaScript tasks.

A. Reduce or inline Render-Blocking Stylesheets

CSS files loaded from the HTML Markup will block the rendering of all content that follows them (which is positive since you do not want to display HTML without styling).

The catch is that if a large CSS file takes significantly longer to load than the LCP resource, the browser has to wait to render the LCP element, even if the resource itself has finished loading.

Here’s what that wait looks like:

The image and CSS start loading at the same time but the image cannot be rendered until the CSS is ready

The image and CSS start loading at the same time, but the browser can’t render the image until the CSS is ready.

I see two options here:

  • Inline the CSS in the HTML.
  • Make the CSS file smaller.

It is important to understand that inlining CSS is recommended only when the weight of the CSS file is small because inline content in HTML does not benefit from the advantages of caching on return visits.

In most cases, the best approach is to shrink the CSS file enough that it loads faster than the LCP asset. That way, the CSS won’t hold up rendering.

Here’s what I recommend:

  • Remove unnecessary CSS from the file. Use Chrome Dev Tools to spot CSS rules the page doesn’t use or that you could load later.
  • Delay loading non-critical CSS. Try splitting your CSS files so the rules the page needs for its initial load are separate from those you can load later (lazy load).
  • Minify and compress the CSS file. I recommend doing this for all CSS files, critical or not, to reduce file size and transfer time.

B. Defer or inline render-blocking JavaScript

It’s rare to need non-asynchronous scripts (scripts without the defer or async attribute) in the <head> of a page. Putting them there when you don’t need to will hurt performance.

When you do need to load JavaScript code as early as possible, I recommend using an inline script so the browser can process it without delay.

As with stylesheets, you should use inline scripts only if it is very small JavaScript code.

C. Break up long tasks

JavaScript can still delay the LCP even if it doesn’t delay processing or load any elements. This usually happens when the page loads particularly large JavaScript files. The browser has to parse and execute them on its main thread.

An image, for example, might have finished downloading, but the browser still has to wait for a script to finish before it can process and display the image.

Modern browsers load images on the browser’s main thread, so if it is busy with other tasks, it will lead to unnecessary delays in processing the LCP element.

D. CSS Animations and Opacity

A frequently overlooked cause of Element Render Delay is using CSS animations that begin with opacity: 0 or visibility: hidden. The browser does not record an element as “painted” while its opacity is zero – so even if the image or heading is fully loaded in the DOM, the LCP clock keeps ticking until the animation reveals it.

This is a common trap in hero section designs. An entrance animation that fades in or slides up from an invisible state can silently add hundreds of milliseconds to the LCP score for a purely cosmetic reason.

To fix it, start the LCP element at opacity: 1. You can still animate properties like transform, scale, or filter without hiding the element. If you need a fade-in effect, trigger it after the first paint, not during the LCP window.

The same problem occurs with A/B testing tools that use anti-flicker snippets. These tools often hide the entire <body> while injecting variant content, which delays the LCP element from becoming visible. If you use such a tool, confirm that its anti-flicker mechanism does not cover the LCP element.

I wrote a detailed case study on exactly this scenario: Fix LCP Delayed by Hero Animations – including before/after waterfall screenshots and the exact CSS fix.

3. Reduce Resource Load Duration

The goal in this part is to actually reduce the time it takes to transfer any asset from the network to the user’s browser. Generally, there are several ways to do this:

  • Make the resource smaller.
  • Shorten the distance the resource has to travel.
  • Reduce contention for network bandwidth.
  • Skip the network trip entirely.

A. Reduce Asset Size

The LCP asset will be either a picture or a text block affected by a web font’s loading time.

The following points and guides will help you understand how to reduce the size/weight of these:

B. Reduce the Distance the Asset Has to Travel

File size isn’t the only thing you can change. You can also cut load times by getting your servers as geographically close to your users as possible. The best way to do that is to use a Content Delivery Network (CDN).

C. Eliminate contention for network bandwidth

Even a smaller LCP asset with less distance to travel can take a long time to load if you’re loading lots of other assets at the same time.

When you give the LCP asset high priority with fetchpriority, the browser does its best to keep less important assets from competing with it as the critical upper part of the page loads. But if many assets have high fetchpriority, or you’re just loading a lot of assets, the LCP asset can still slow down.

D. Completely Eliminate the Time Required to Load the Asset

The best way to cut an asset’s load time is to avoid fetching it from the server over the network at all.

With effective cache-control settings, the browser loads those assets from the cache for users who have already visited your site once. That completely eliminates the resource load duration I mentioned earlier.

If your LCP asset is a web font, beyond the option to reduce the font size, you might want to consider whether you want the font to be considered a loading-blocking asset. If you set the font-display property with any value other than block or auto, then the text will always appear during loading and the LCP will not be delayed.

Be aware, your decision regarding the value of font-display will have an impact on the Visual Stability (CLS) in Core Web Vitals.

4. Reduce Time to First Byte (TTFB)

My goal here is to serve the initial HTML as quickly as possible. Time to first byte directly affects every step that follows, so it makes a real difference to both the LCP score and the overall page load time.

Nothing can progress before the server serves the first byte of content, so any improvement in TTFB is likely to improve every other metric in Core Web Vitals.

A good hosting server makes a real difference to first byte time and to the LCP score more broadly. For a closer look, I wrote a detailed post on what TTFB is and how to improve it.

FAQs

Here are some common questions about Largest Contentful Paint:

What is a good LCP score?
An LCP of 2.5 seconds or less is considered good by Google's Core Web Vitals standards. Scores between 2.5 and 4.0 seconds need improvement, and anything above 4.0 seconds is considered poor. Google measures this at the 75th percentile of page loads, separately for mobile and desktop.
What elements can be the LCP element?
The LCP element is the largest visible content element in the viewport when the page loads. This can be an <img> element (including hero and banner images), an <image> inside an SVG, a video (its poster image or first frame, whichever appears first), an element with a CSS background image, or a block of text. The browser determines which element is the LCP based on its rendered size in the viewport.
What is the difference between fetchpriority="high" and loading="eager"?
loading="eager" is the default behavior for images and simply means "do not lazy load this image." It does not change the priority at which the browser fetches it. fetchpriority="high" actively tells the browser to prioritize this resource earlier in the loading process, before it has determined the image's layout importance. For LCP images, you should use fetchpriority="high" to ensure the browser starts downloading the image as soon as possible.
Does lazy loading affect LCP?
Yes, lazy loading can significantly harm LCP if applied to the LCP image. When an image has loading="lazy", the browser delays loading it until it is near the viewport, which adds unnecessary delay for above-the-fold content. Never use lazy loading on images that appear in the initial viewport, especially the LCP element. Reserve lazy loading for images below the fold.
Should I use lab data or field data to measure LCP?
Prioritize field data (real user data) from tools like Google Search Console, PageSpeed Insights (CrUX data), or the Chrome User Experience Report. Field data reflects actual user experiences across different devices and network conditions. Lab data from tools like Lighthouse is useful for debugging and testing specific optimizations, but it does not capture the full range of real-world conditions.
How does LCP relate to the other Core Web Vitals?
LCP is one of three Core Web Vitals. It measures loading performance. The other two are INP (Interaction to Next Paint), which measures responsiveness to user interactions, and CLS (Cumulative Layout Shift), which measures visual stability. INP replaced the older FID (First Input Delay) metric in March 2024. All three metrics need to pass their respective thresholds for a page to have good Core Web Vitals.

Summary

Understanding and improving the LCP score on sites can be complex, and the timing of this metric is influenced by several factors. But if you treat the optimization of the LCP as the optimization of the specific LCP element, it might simplify things.

At a glance, the optimization of the LCP score can be summarized in four main points:

  1. Get the LCP asset loading as early as possible.
  2. Make sure the browser can process and display the LCP element as soon as its asset finishes loading.
  3. Keep the LCP asset loading time as short as possible.
  4. Make sure the server delivers the initial HTML as quickly as possible.

If you carry out these actions, be assured that you are providing an optimal user experience to visitors in this regard, and you will quickly find that your site’s LCP score is improving accordingly.

Summarize with AI Claude ChatGPT Google AI
Discussion
[  0 Comments  ]

Leave a Comment

To add code, use the buttons below. For instance, click the PHP button to insert PHP code within the shortcode. If you notice any typos, please let us know!