---
title: "Largest Contentful Paint: finding and fixing a slow LCP"
description: "How to diagnose a slow Largest Contentful Paint by splitting it into four sub-parts, measuring each with DevTools and web-vitals, then fixing the one that is actually slow."
url: https://www.danny.engineering/article/largest-contentful-paint-finding-and-fixing-a-slow-lcp
author: Danny
published: 2026-12-03T00:00:00.000Z
updated: 2026-12-02T12:55:00.000Z
tags: ["Performance", "HTML"]
---

# Largest Contentful Paint: finding and fixing a slow LCP

Your PageSpeed report says Largest Contentful Paint is 4.1 seconds. The usual advice arrives straight away: compress the hero image, add a preload, try a CDN. Sometimes that works. Often it does nothing, because the image was never the slow part. The server was slow to respond, or the image was discovered late, or it had loaded and was waiting for JavaScript before it could appear.


This article is for developers who have a slow LCP and want to find out why before changing anything. We will look at what LCP measures, break it into its four sub-parts, measure each one in the field and in DevTools, and then fix whichever part is actually costing you time.


## What LCP measures


Largest Contentful Paint is the time from the start of navigation until the largest image or text block in the viewport is rendered. A good LCP is 2.5 seconds or less, measured at the 75th percentile of real page loads. Above 4 seconds is poor.


The elements that can be the LCP element are:

- `img` elements, and `image` elements inside an `svg`
- `video` elements, using the poster image or the first painted frame
- elements with a background image loaded through `url()` in CSS
- block-level elements containing text

The browser keeps reporting new candidates as larger content paints, and stops once the user interacts with the page. The last candidate is the LCP. A detail that surprises people: on many pages the LCP element is a heading or a paragraph, not an image. If that is the case for you, no amount of image work will help.


## The four sub-parts


Every LCP time can be split into four consecutive pieces. Together they add up to the full LCP.

1. **Time to First Byte (TTFB).** From the start of navigation until the first byte of the HTML arrives.
2. **Resource load delay.** From TTFB until the browser starts downloading the LCP resource. For a text LCP with no web font, this is zero.
3. **Resource load duration.** How long the LCP resource takes to download. Zero for plain text.
4. **Element render delay.** From the resource finishing until the element is actually painted.

As a rough guide, a well-optimised page spends most of its LCP in TTFB and load duration, with both delays close to zero. When a delay is large, that is where the time is being wasted, because the browser is either not asking for the resource or not showing it once it has it.


This is why diagnosis comes first. A 4 second LCP made of 3 seconds of TTFB needs server work. The same 4 seconds made of 2.5 seconds of render delay needs JavaScript or CSS work. Compressing the image fixes neither.


## Measure in the field first


Lab tools run on one machine with one network profile. Your users have many of each. Start with field data so you know whether there is a real problem and which pages have it.

- **PageSpeed Insights and Search Console** show Chrome User Experience Report (CrUX) data for your origin and popular URLs. CrUX only includes Chrome users.
- **Your own real user monitoring** gives you every browser that supports LCP and lets you break the number down.

The `web-vitals` library has an attribution build that reports the four sub-parts directly, along with the element that was the LCP.


```javascript
import { onLCP } from "web-vitals/attribution";

onLCP(({ value, rating, attribution }) => {
  const body = JSON.stringify({
    page: location.pathname,
    value,
    rating,
    element: attribution.target,
    url: attribution.url,
    ttfb: attribution.timeToFirstByte,
    loadDelay: attribution.resourceLoadDelay,
    loadDuration: attribution.resourceLoadDuration,
    renderDelay: attribution.elementRenderDelay,
  });

  navigator.sendBeacon("/analytics/lcp", body);
});
```


Collect this for a few days, then group by page and look at the 75th percentile of each sub-part. You will usually find that one part dominates. That is the one to fix. The `target` field tells you which element it was, which is often a surprise in itself, especially on mobile where a different element may be largest.


## Measure in DevTools


Once you know which page and which sub-part, reproduce it locally in Chrome DevTools.

1. Open the **Performance** panel. The live metrics view shows LCP for the current page as you load it, along with the LCP element. Click the element to highlight it in the page.
2. Turn on CPU and network throttling that matches your field data. A fast laptop on office Wi-Fi will hide most problems.
3. Record a page load. In the **Insights** sidebar, the LCP breakdown shows the same sub-parts as the web-vitals attribution build, and the LCP request discovery insight checks whether the LCP image was discoverable in the HTML, had high priority and was not lazy-loaded.

If you want a quick check without recording a trace, you can log LCP candidates in the console.


```javascript
new PerformanceObserver((list) => {
  for (const entry of list.getEntries()) {
    console.log("LCP candidate", entry.startTime, entry.element, entry.url);
  }
}).observe({ type: "largest-contentful-paint", buffered: true });
```


The last entry logged before you interact is the LCP.


## Fixing a slow TTFB


If TTFB is most of your LCP, nothing on the page itself can help much. The browser cannot start on anything until the HTML arrives.

- **Cache HTML at the edge** where you can. A page served from a CDN cache is usually far faster than one rendered on demand.
- **Remove redirects.** Each redirect, such as `http` to `https` or a bare domain to `www`, adds a full round trip before the real request starts.
- **Stream the response.** Frameworks that support streaming can send the `head` and the top of the page while slower data is still loading, so the browser can start fetching CSS and the LCP image early.
- **Find the slow work.** The `Server-Timing` response header lets your server report how long database queries and other steps took, and the values appear in DevTools and in the navigation timing entry.

```javascript
// In a Node.js request handler, after timing each step
res.setHeader("Server-Timing", "db;dur=412, render;dur=96");
```


## Fixing resource load delay


A large resource load delay means the browser had the HTML but did not start downloading the LCP resource straight away. This is the most common cause of a slow image LCP, and it is about discovery and priority rather than file size.


The usual culprits:

- The image is a CSS background, so the browser only finds it after downloading and parsing the stylesheet.
- The image is added by JavaScript, so the browser only finds it after the script runs.
- The image has `loading="lazy"`, so the browser waits for layout before deciding to load it.
- The image has a `data-src` attribute that a lazy-loading script swaps in later.
- The image is discovered on time but downloaded at low priority behind scripts and other images.

The fix is to make the LCP image a normal `img` in the server-rendered HTML, never lazy-load it, and give it high priority.


```html
<img
  src="/images/hero-1200.avif"
  srcset="/images/hero-800.avif 800w, /images/hero-1200.avif 1200w"
  sizes="100vw"
  width="1200"
  height="600"
  alt="A team reviewing a performance dashboard"
  fetchpriority="high"
/>
```


If the image genuinely has to be a background, preload it so the browser does not wait for the CSS.


```html
<link rel="preload" as="image" href="/images/hero-1200.avif" fetchpriority="high" />
```


If the LCP image is on another origin, such as an image CDN, a `preconnect` to that origin can save the connection setup time too.


## Fixing resource load duration


If the image is requested early but still takes a long time to download, it is too big for the connection or it is coming from too far away. This is where image formats, responsive sizes and compression matter. Serving AVIF or WebP at the size it is displayed, from a CDN close to the user, usually shrinks this sub-part a lot. Our article on loading images fast covers formats, `srcset`, `sizes` and `fetchpriority` in detail, so we will not repeat it here.


One thing to check that is easy to miss: other downloads competing for bandwidth at the same time. A large script or several carousel images fetched alongside the hero image will slow it down, even if the hero itself is small.


## Fixing element render delay


A large render delay means the resource was ready, but the browser could not paint the element. Something was blocking rendering.

- **Render-blocking CSS and scripts.** Stylesheets and synchronous scripts in the `head` block the first render. Inline the critical CSS, defer non-critical scripts and remove anything that does not need to run before the page appears.
- **Client-side rendering.** If the LCP element is created by a JavaScript framework in the browser, it cannot appear until the bundle downloads, parses and runs. Server-rendering the above-the-fold content usually fixes this.
- **Hiding the page while experiments load.** Some A/B testing tools hide the whole page until their script decides which variant to show. That delay lands directly in render delay.
- **Web fonts for text LCP.** If the LCP element is text in a web font, the browser may hide it until the font loads. Using `font-display: swap` or `optional`, and preloading the font file, lets the text appear sooner.

```css
@font-face {
  font-family: "Inter";
  src: url("/fonts/inter-var.woff2") format("woff2");
  font-display: swap;
}
```

- **Animations on the LCP element.** An element that fades in from zero opacity is not counted until it is visible, so an entrance animation on your hero can add its whole duration to LCP.

## Browser support


The Largest Contentful Paint API is supported in Chrome and Edge, in Firefox since version 122, and in Safari since 26.2, released in December 2025. With Safari's support, LCP became Baseline newly available, so your real user monitoring can now include visitors on iPhones.


There are small differences to be aware of. Chrome measures up to the moment the frame is presented on screen, while Firefox and Safari stop at the earlier paint time, so the same page can report slightly different values. CrUX, PageSpeed Insights and Search Console still only show Chrome data, so Safari users will appear only in your own monitoring.


## When not to rely on it


LCP is a useful signal, but it is not the whole story.

- **Single-page app navigations.** LCP is measured for the initial page load. Navigations handled by client-side routing are not counted as new page loads, so a slow in-app transition will not show up. Chrome shipped the Soft Navigations API in Chrome 151, but soft navigation versions of LCP in CrUX are still experimental, and the standard LCP metric still covers only the initial page load.
- **Pages where the main content is not the largest.** If a large decorative image or a cookie banner is the LCP element, a good LCP does not mean your actual content is fast. Check the `target` in your data.
- **Chasing a lab score.** A green Lighthouse score on a fast machine says little about real users. Fix what your field data shows, and confirm the fix in the field.
- **At the expense of other metrics.** Preloading too many things or prioritising everything can make interactivity and layout stability worse.

## Wrapping up

- LCP is made of four parts: TTFB, resource load delay, resource load duration and element render delay. Find out which one is slow before changing anything.
- Use the `web-vitals` attribution build in the field and the Performance panel insights in DevTools to get the breakdown.
- Large delays are usually discovery or blocking problems. Put the LCP image in the HTML, do not lazy-load it, and give it high priority.
- Image size and format only help when load duration is the slow part.
- On many pages the LCP element is text, so check render-blocking resources and web fonts too.
