What is LCP (Largest Contentful Paint) in Core Web Vitals?

IntermediatePerformance interview questionBy , updated 24 November 2026

Short answer

LCP, or Largest Contentful Paint, is the Core Web Vital for loading speed. It is the time from the start of navigation until the largest image, video or block of text visible in the viewport is rendered. Google rates it good at 2.5 seconds or less and poor above 4 seconds, measured at the 75th percentile of real page loads. Every slow LCP splits into four parts: TTFB, resource load delay, resource load duration and element render delay.

What counts as the LCP element

LCP is one of three metrics covered in Core Web Vitals: LCP, INP and CLS. This page goes deeper on LCP alone. According to web.dev, these element types can be the LCP element:

  • <img> elements. For animated images such as GIFs, the time the first frame is shown is used.
  • <image> elements inside an <svg>. The <svg> itself is not a candidate.
  • <video> elements: the poster image load or the first frame shown, whichever comes first.
  • Elements with a background image loaded through url(). CSS gradients do not count.
  • Block-level elements that contain text nodes or inline text children, such as a heading or a paragraph.

Size is the area the user actually sees. Parts outside the viewport, clipped or hidden in overflow do not count, and neither do margins, padding or borders. For a resized image the browser uses the smaller of the displayed size and the image's intrinsic size, so a small thumbnail stretched to fill a banner is scored at its smaller natural size. For text, the size is the smallest rectangle that holds all its text nodes.

Chromium also skips some elements to match what people perceive as content: elements with opacity: 0, elements that cover the whole viewport (treated as background), and low-entropy placeholder images.

When the browser stops reporting candidates

The page paints in stages, so the largest element can change. A heading may paint first and become the first candidate, then the hero image finishes and replaces it. Each time a larger element renders, the browser dispatches a new largest-contentful-paint entry. The LCP value is the last entry reported.

Reporting stops as soon as the user interacts with the page through a tap, scroll or key press, because what the user does next changes what is on screen. A few more edge cases matter in real measurement:

  • If the page loaded in a background tab, Google's tools do not report LCP for it, and entries dispatched after the page is hidden should be ignored.
  • A page restored from the back/forward cache does not produce new entries, but users see it as a new visit, so libraries measure it separately.
  • For a prerendered page, LCP is counted from when the page was activated (activationStart), not from when prerendering began.
  • Elements inside iframes are not visible to the API in the parent page, although CrUX includes them.

Thresholds

Rating LCP at the 75th percentile
Good 2.5 s or less
Needs improvement over 2.5 s up to 4 s
Poor over 4 s

The 75th percentile is taken separately for mobile and desktop. A page passes on mobile only if at least three quarters of mobile visits render the LCP element within 2.5 seconds, which is why slow phones on slow networks decide the result. Why Google picked p75 is explained in RUM vs synthetic monitoring.

The four sub-parts of LCP

web.dev splits LCP into four sub-parts that add up to the whole value. Find the largest one before you change anything, because each has different fixes.

Sub-part From To web.dev target share
Time to First Byte (TTFB) Navigation starts First byte of the HTML arrives about 40%
Resource load delay TTFB Browser starts loading the LCP resource under 10%
Resource load duration LCP resource request starts LCP resource finishes loading about 40%
Element render delay LCP resource finished LCP element fully rendered under 10%

If the LCP element is text in a system font, there is no resource, so the delay and duration parts are zero and the time is TTFB plus render delay. A web font adds a load of its own; loading web fonts without layout shift covers font-display and preloading the font file.

Fixing TTFB

TTFB is server and network time. Cache the HTML at a CDN where you can, avoid redirects (each one is a full round trip), and avoid unique query parameters such as campaign tags that turn every request into a cache miss. Stream the HTML so the <head> and the hero markup leave the server before slow data is ready. A 103 Early Hints response can also let the browser start fetching critical files while the server is still working.

Fixing resource load delay

This is the most common waste, and the cheapest to remove. The browser can only start fetching the LCP image once it knows about it. The preload scanner finds <img> tags in the HTML early, but it cannot see an image that is only referenced in CSS or inserted by JavaScript. Fixes, in order of preference:

  1. Put the hero in the server-rendered HTML as a plain <img> with src or srcset.
  2. Add fetchpriority="high" to it. Browsers usually start image requests at a lower priority and raise the visible ones only after layout, so the hint lets the hero compete with scripts and stylesheets from the first request. web.dev warns that marking more than one or two images as high priority makes the hint useless.
  3. Never put loading="lazy" on the hero. Lazy images wait until layout shows they are near the viewport, which always adds delay. See lazy loading for images and routes for which images to lazy-load.
  4. If the image has to stay a CSS background, or is found late for another reason, preload it.
<!-- Hero as a real image: discoverable, prioritised, not lazy -->
<img src="/hero-1200.avif"
     srcset="/hero-800.avif 800w, /hero-1200.avif 1200w, /hero-2000.avif 2000w"
     sizes="100vw" width="1200" height="600"
     fetchpriority="high" alt="Winter jackets on a rail" />

<!-- Hero only reachable from CSS: preload it, matching the responsive candidates -->
<link rel="preload" as="image" fetchpriority="high"
      href="/banner-1200.avif"
      imagesrcset="/banner-800.avif 800w, /banner-1200.avif 1200w"
      imagesizes="100vw" />

A preload has to match what the page will actually use, or the browser downloads two files. imagesrcset and imagesizes let the preload pick the same candidate the <img> or image-set() would pick. The full trade-offs of preload, including how too many preloads slow everything down, are in preload vs prefetch vs preconnect. fetchpriority="high" is supported in Chrome and Edge 101, Firefox 132 and Safari 17.2.

The reverse also helps: set fetchpriority="low" on images that are in the HTML but not visible yet, such as later carousel slides, so they stop competing with the hero.

Fixing resource load duration

This is download time. Send fewer bytes: serve AVIF or WebP, size the file to the slot with srcset and sizes, and compress sensibly (optimising images for the web has the details). Serve images from a CDN close to users, with long cache lifetimes for fingerprinted URLs so repeat visits skip the download. Serving the image from the same origin as the page, or using preconnect to an image CDN, avoids paying for a new connection.

Fixing element render delay

The image has arrived but is not on screen yet. The usual causes:

  • Render-blocking CSS or synchronous scripts in the <head> that are still downloading. Inline small critical CSS, shrink large stylesheets, and mark scripts defer or async.
  • Client-side rendering. The LCP element does not exist until a JavaScript bundle loads and runs. Server-render or prerender the above-the-fold markup.
  • A/B testing or anti-flicker snippets that hide the page until an experiment is assigned.
  • Long tasks on the main thread, because rendering happens on the main thread too. Break them up, as described in long tasks and the main thread.
  • A carousel or component that inserts the image later than the image actually loaded.

Measuring LCP in code

The raw API is PerformanceObserver with the largest-contentful-paint entry type. buffered: true delivers entries that happened before your script ran.

new PerformanceObserver((list) => {
  for (const entry of list.getEntries()) {
    // The last entry before user input is the page's LCP
    console.log(entry.startTime, entry.size, entry.url, entry.element);
  }
}).observe({ type: "largest-contentful-paint", buffered: true });

That only logs candidates. Turning them into a correct metric means handling input, background tabs, back/forward cache restores and prerendering, which is why most teams use Google's web-vitals library. Its attribution build also computes the four sub-parts for you:

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

onLCP(({ value, rating, attribution }) => {
  const { target, url, timeToFirstByte, resourceLoadDelay, resourceLoadDuration, elementRenderDelay } = attribution;
  navigator.sendBeacon("/rum", JSON.stringify({
    name: "LCP", value, rating, target, url,
    timeToFirstByte, resourceLoadDelay, resourceLoadDuration, elementRenderDelay,
  }));
});

Sending target (a selector for the element) matters: the LCP element often differs between mobile and desktop, or between pages using the same template. The largest-contentful-paint entry is available in Chrome 77, Firefox 122 and Safari 26.2, so as of late 2026 you can collect LCP in all three engines, although CrUX itself only contains Chrome data. Building this kind of reporter is the exercise in a performance monitor measuring Web Vitals, and reconstructing the request chain behind a slow LCP image is in building a request waterfall from Resource Timing.

LCP in single-page apps

LCP was designed for full page loads. Route changes in an SPA do not trigger new largest-contentful-paint entries in the standard API, and the click that starts a route change also ends LCP reporting for the initial load.

As of late 2026, Chrome has the Soft Navigations API enabled by default from Chrome 151 (Edge 151 too). The browser detects a soft navigation when a user interaction, a URL change and a paint happen together, emits a soft-navigation entry, and derives LCP for it from interaction-contentful-paint entries. Firefox and Safari do not support it. web-vitals version 6 reports these with an option:

import { onLCP } from "web-vitals";

onLCP(sendToAnalytics, { reportSoftNavs: true });
// metric.navigationType is "soft-navigation" for route changes

Two caveats. For a soft navigation, TTFB is reported as 0, and elements that stay on screen between routes do not count because they are not repainted, so the same page can score differently after a soft and a hard navigation. And CrUX only publishes soft navigation metrics as experimental ones; Chrome's documentation says it plans to make them stable in May 2027. Until then, Search Console and the Core Web Vitals assessment are still based on full page loads.

Lab data versus field data for LCP

Lighthouse and the DevTools Performance panel measure LCP on one load with fixed throttling. That is the right place to debug, because a trace shows the LCP element, its request and the sub-parts. Field data from CrUX or your own RUM is what is assessed. Expect differences: real users arrive with a warm or cold cache, from different countries, on slower phones, and sometimes see a different LCP element (a cookie banner's text can become the LCP element on mobile). If lab is fast and field is slow, look at TTFB by country and at the LCP element by device before touching the front end.

Follow-up questions interviewers ask

Can the LCP element be something you did not expect?

Yes, often. A cookie consent banner, a large promotional heading or a product description can be larger than the hero on narrow screens. Always log the element in the field instead of assuming it is the hero image.

Does a skeleton or a blurred placeholder improve LCP?

Not by itself. Low-entropy placeholders are excluded as candidates, so LCP waits for the real image. A placeholder helps perceived speed and avoids layout shift, but the fix for LCP is still to get the real image earlier.

Should I preload the LCP image if it is already an <img> in the HTML?

Usually not. The preload scanner already finds it, so fetchpriority="high" is the better fix. Preload is for images the scanner cannot see, such as CSS backgrounds or images chosen by JavaScript.

Is LCP measured when an SPA changes route?

Not by the standard API and not in the Core Web Vitals assessment. Only the first full load gets an LCP. To see slow route changes, use the Soft Navigations API in Chromium 151 and later, or record your own timing from the click to the moment the new route's main content renders.

How do you fix LCP when the hero comes from a CMS and changes daily?

Render the hero <img> on the server from the CMS data so it is in the HTML, use an image CDN to produce sized AVIF or WebP variants from one URL, and set fetchpriority="high" in the template. The design is the subject of image delivery for an e-commerce site.

Practise it

Apply the sub-part breakdown to a slow page in Diagnose and fix a poor LCP on a product page, then pick the right hints in Choose resource hints for a landing page.

Mistakes to avoid

  • Fixing image size when the real problem is resource load delay or TTFB

    Measure the sub-parts first.

  • Lazy-loading the hero, or letting a component library add loading="lazy" to every image

  • Marking many images fetchpriority="high", so none of them stands out

  • Preloading a different file from the one the page renders, which downloads twice

  • Hiding the page behind an anti-flicker snippet and then blaming the image

  • Judging LCP from one Lighthouse run on a fast laptop instead of p75 field data on mobile

Practise it in code

Interviewers rarely stop at the definition. These questions open in an editor with tests.

  1. Diagnose and fix a poor LCP on a product pageHard45 min
  2. Build a request waterfall from Resource Timing: connection phases and the chain that delays the LCP imageMedium45 min
  3. Choose resource hints for a landing page: preload, preconnect, prefetch, modulepreload and fetchpriorityMedium30 min
  4. Design image delivery for an e-commerce site: responsive images, AVIF and WebP, CDN transforms, the LCP image and placeholdersHard55 min
  5. Implement a performance monitor measuring Web Vitals and reporting metricsMedium45 min