Skip to content
FrontDepth, Home

Browser & Performance

Core Web Vitals: LCP, CLS and INP

What Google's Core Web Vitals measure and how they are scored — LCP, CLS and INP, their thresholds and the 75th percentile rule — and how to measure them in the field and the lab and fix each one.

JuniorMiddleSeniorUpdated 16 November 2026

Reading level

Shows sections up to the selected level.

Before you start

This topic starts at Junior level.

JuniorConcept

What Core Web Vitals are

Core Web Vitals are three user-centred metrics that Google recommends tracking on every page. Each one answers a question a user would ask:

  • LCP — Largest Contentful Paint (loading): has the main content appeared?
  • INP — Interaction to Next Paint (responsiveness): does the page react quickly when I click, tap or type?
  • CLS — Cumulative Layout Shift (visual stability): does the content stay where it is, or does it jump?

Thresholds

MetricGoodNeeds improvementPoor
LCP≤ 2.5 s2.5 s – 4 s> 4 s
INP≤ 200 ms200 ms – 500 ms> 500 ms
CLS≤ 0.10.1 – 0.25> 0.25

The 75th percentile rule

A metric is not judged by one measurement or by the average. Each is assessed at the 75th percentile of page loads, segmented into mobile and desktop. A page "passes" when all three are good at the 75th percentile, which means at least three out of four visits had a good experience on each metric. The percentile is robust: a few extreme visits do not decide the result, but a slow quarter of your users does. An average, in contrast, can look fine while a large group of users suffers.

How the set changes

Metrics go through a lifecycle: experimental → pending → stable, and stable Core Web Vitals change at most once per year. The last change was on March 12, 2024, when INP replaced First Input Delay (FID). FID measured only the delay before the first interaction's handlers could start; INP covers every interaction and the whole time until the next frame is painted.

Other metrics are useful for diagnosis but are not Core Web Vitals: Time to First Byte (TTFB), (FCP), and Total Blocking Time (TBT) in the lab.

How this relates to the critical rendering path

The topic explains what the browser does before the first render. LCP is how you see the result of that work in real users' data, CLS tells you whether the layout stayed stable while resources arrived, and INP is about everything after load: how fast the page responds once people start using it.

JuniorWeb platform

LCP: when the main content appears

reports the render time of the largest image, text block or video visible in the viewport, measured from the moment the page started loading. The idea: the biggest thing on the first screen is most likely what the user came for — the product photo, the article headline, the hero video.

Which elements count

  • <img> elements, and <image> elements inside an <svg>;
  • <video> elements (their poster image or first frame);
  • elements with a background image loaded with url() (a CSS gradient does not count);
  • block-level elements that contain text.

Chromium also ignores elements that are unlikely to be "content": elements with opacity: 0, elements that cover the whole viewport (treated as a background), and low-entropy placeholder images.

Candidates, not one measurement

The page renders in steps, so the browser reports a new LCP candidate every time a larger element is painted: first maybe the headline, then the hero image once it has loaded. The last candidate wins. The browser stops reporting new candidates as soon as the user interacts with the page (a tap, a scroll or a key press), because after that the user is already using the page.

The size that counts is the part visible in the viewport: whatever is clipped or below the fold does not count. That is why the LCP element on a phone is often different from the one on a desktop screen.

Seeing it in the browser

JavaScript
new PerformanceObserver((list) => {
  const entries = list.getEntries();
  const last = entries[entries.length - 1];
  console.log("LCP candidate", Math.round(last.startTime), last.element);
}).observe({ type: "largest-contentful-paint", buffered: true });

buffered: true also delivers the entries recorded before the observer was created. Run this in the console of a product page and you will usually see two or three candidates, ending with the main product photo.

What makes LCP slow

The four typical reasons: the server answers slowly (late first byte), the browser finds the image late (it is added by JavaScript or hidden in CSS), the image is too heavy, or the image has arrived but rendering is blocked by CSS, JavaScript or a long task. The "Fixing LCP" section breaks LCP into these four parts and shows the fix for each.

JuniorWeb platform

CLS: layout shifts and session windows

You are about to tap "Add to cart" and a banner appears above it: the button jumps down and you tap something else. Cumulative Layout Shift measures exactly this kind of unexpected movement.

What a layout shift is

A layout shift happens when a visible element changes its start position between two frames. Adding a new element or resizing one is not a shift by itself; it becomes one when it pushes other visible elements to a new position. Each shift gets a score:

Text
layout shift score = impact fraction × distance fraction
  • Impact fraction: the part of the viewport covered by the unstable elements, counting both their old and new positions.
  • Distance fraction: how far they moved, relative to the viewport's larger dimension.

Example from web.dev: an element covers half of a portrait viewport and moves down by a quarter of the viewport height. Old and new positions together cover 75% of the viewport, so the impact fraction is 0.75; the distance fraction is 0.25; the score is 0.75 × 0.25 = 0.1875. A single shift like that already makes the page "needs improvement".

What does not count

  • Expected shifts. Shifts within 500 ms of a discrete user input (click, tap, key press) are flagged with hadRecentInput and excluded: if you open an accordion, the content below is expected to move. Scrolling, dragging and pinch-zooming do not count as recent input.
  • Transforms. Animating transform: translate() or scale() moves pixels without changing layout positions, so it is not a layout shift. Animating top or height is.

Session windows

CLS is not the sum of all shifts over the whole visit. Shifts are grouped into session windows: a window continues while each shift comes less than 1 second after the previous one, and it lasts at most 5 seconds. The page's CLS is the score of its worst window. A long-lived single-page app therefore is not punished for many small, far-apart shifts, but a burst of shifts while the page loads still counts in full.

Typical causes

Images and iframes without dimensions, ads and embeds without reserved space, content inserted above existing content (cookie notices, promo banners, "you may also like" blocks), web fonts that change text size when they arrive, and animations of layout properties. The "Fixing CLS" section takes them one by one.

MiddleWeb platform

INP: how long interactions take to show a result

Interaction to Next Paint observes every click, tap and key press during the visit (hovering and scrolling are not interactions for INP) and measures how long it takes from the input until the browser presents the next frame, the moment the user can see that something happened.

Three phases of one interaction

Text
input ──► handlers start ──► handlers end ──► next frame presented
 └── input delay ──┘└─ processing ─┘└─ presentation delay ─┘
  1. Input delay — the is busy with something else (a long task, a timer, hydration), so the event handlers cannot start yet.
  2. Processing duration — all event callbacks for the interaction run (pointerdown, pointerup, click, or keydown, keyup, and so on), plus whatever state updates and renders they trigger synchronously.
  3. Presentation delay — after the handlers, the browser recalculates style, runs layout, paints and presents the frame. A large DOM, layout thrashing or a huge innerHTML update makes this long.

From interactions to one number

The page's INP is its longest interaction, ignoring outliers: for every 50 interactions, the single highest one is ignored, so one unlucky interaction on a busy page does not define it. Across users, INP is assessed like the others, at the 75th percentile: good ≤ 200 ms, poor > 500 ms. A visit without any click, tap or key press has no INP value at all, which is different from a good value.

Why FID was not enough

First Input Delay measured only phase 1, and only for the first interaction. A page could have a perfect FID while every later click took a second to render because the handler itself was slow. INP covers all three phases for all interactions, which is why it became a Core Web Vital instead of FID in March 2024.

The browser API underneath

INP is built on the Event Timing API. Entries of type event carry an interactionId that groups the events of one interaction; by default only events of 104 ms or longer are reported, and durationThreshold lowers that to as little as 16 ms:

JavaScript
new PerformanceObserver((list) => {
  for (const entry of list.getEntries()) {
    if (!entry.interactionId) continue;
    const inputDelay = entry.processingStart - entry.startTime;
    console.log(entry.name, Math.round(entry.duration), Math.round(inputDelay));
  }
}).observe({ type: "event", durationThreshold: 16, buffered: true });

In practice you rarely write this yourself; the web-vitals library does the grouping and outlier rules for you.

MiddleWeb platform

Measuring: field data and lab data

Field data (real user monitoring, RUM) comes from real visits: real devices, networks, caches and interactions. Lab data comes from loading the page in a controlled setup. Core Web Vitals are defined on field data; the lab is where you debug.

Field data

  • CrUX (Chrome UX Report) aggregates data from real Chrome users who opted in, over a rolling 28-day window, per origin and per URL when there is enough traffic. You see it in PageSpeed Insights, Search Console and the CrUX API. Because the window is 28 days, a fix shows up in CrUX gradually.
  • Your own RUM, usually with Google's web-vitals library. It applies the official rules (LCP candidates, CLS session windows, INP outliers) and reports CLS and INP when the page is hidden, because they can keep changing until then.
JavaScript
import { onCLS, onINP, onLCP } from "web-vitals/attribution";

function send(metric) {
  const body = JSON.stringify({
    name: metric.name,
    value: metric.value,
    rating: metric.rating,
    id: metric.id,
    attribution: metric.attribution,
  });
  navigator.sendBeacon("/analytics/vitals", body);
}

onLCP(send);
onCLS(send);
onINP(send);

The attribution build adds the "why": the LCP element and its four sub-parts, the element that shifted most, the INP target and its three phases. onFID was removed in web-vitals v5 (2025); v6 (2026) added support for soft navigations.

Browser support matters for RUM. largest-contentful-paint and Event Timing entries (with interactionId, which INP needs) are available in Chromium, Firefox and Safari 26.2+, but layout-shift is Chromium-only, so your CLS data comes from Chromium users. CrUX itself contains Chrome users only.

Lab data

  • Lighthouse loads the page once on an emulated mid-range phone with a throttled network. It reports LCP and CLS during load, but a page-load run has no user interactions, so instead of INP it reports Total Blocking Time as a proxy.
  • The DevTools Performance panel shows live LCP, CLS and INP while you use the page, can compare them with CrUX, and its Insights include LCP breakdown, INP breakdown and Layout shift culprits.

Why the two disagree

Lab runs use a cold cache and one fixed device and viewport, and they stop at load. Real users have warm caches, different screens (different LCP elements), personalised content, and they scroll and click: field CLS includes shifts long after load, and only the field has real INP. Decide what to fix from field data, then reproduce and verify in the lab.

Single-page apps are a special case: a route change is a "soft navigation". Chrome measures them by default since Chrome 151, and CrUX reports them as experimental metrics, planned to become stable in May 2027.

MiddleExample

Fixing LCP: break it into four parts

"LCP is 4.1 seconds" does not tell you what to fix. web.dev splits LCP into four sub-parts that add up to the whole:

Sub-partFrom → toRough share of a good LCP
Time to First Byte (TTFB)navigation start → first byte of the HTMLabout 40%
Resource load delayTTFB → the LCP resource starts loadingunder 10%
Resource load durationstart → end of that resource's downloadabout 40%
Element render delayresource loaded → LCP element renderedunder 10%

If the LCP element is text in a system font, there is no resource: both load parts are zero. The DevTools LCP breakdown insight and the web-vitals attribution build give you these numbers; fix the largest one first.

Per sub-part

  • TTFB: cache HTML at a CDN edge, avoid redirect chains, render on the server or prerender pages that are the same for everyone. Server rendering removes client work but adds server time, so measure both.
  • Load delay: make the LCP resource discoverable in the HTML so the finds it immediately: a real <img src> (or srcset), not an image inserted by JavaScript or a background-image in an external stylesheet. If it must come from CSS or JS, add <link rel="preload">. Give it fetchpriority="high" (on one or two images at most), and never loading="lazy": lazy loading waits for layout to know the image is near the viewport.
  • Load duration: send fewer bytes: AVIF or WebP, srcset/sizes so phones do not download desktop images, sensible compression, an image CDN.
  • Render delay: the image has arrived but is not shown yet. Typical causes are stylesheets and synchronous scripts in the <head>, a client-rendered app that creates the <img> only after its bundle runs, an A/B testing script that hides the page, and long tasks on the main thread.

A product page hero

On the platform's product page design problem, the main product photo is the natural LCP candidate. Markup that serves it well:

HTML
<link rel="preload" as="image" href="/img/sneaker-800.avif"
  imagesrcset="/img/sneaker-400.avif 400w, /img/sneaker-800.avif 800w"
  imagesizes="(max-width: 600px) 100vw, 50vw" fetchpriority="high" />

<img src="/img/sneaker-800.avif"
  srcset="/img/sneaker-400.avif 400w, /img/sneaker-800.avif 800w"
  sizes="(max-width: 600px) 100vw, 50vw"
  width="800" height="800" alt="Runner sneaker, side view"
  fetchpriority="high" />

The preload only matters when the <img> is not in the initial HTML (for example, it is rendered on the client); if it is, the <img> with fetchpriority="high" is enough. Gallery images below the fold can stay loading="lazy". The Critical Rendering Path topic covers render-blocking resources and the preload scanner in depth.

MiddleExample

Fixing CLS: reserve space, don't push content

Almost every CLS fix is the same idea: decide the size of the space before the content arrives, and never insert something above content the user is already looking at.

Images, video and iframes

Give media width and height attributes. Browsers turn them into an aspect ratio before the file loads, so the box has the right height from the first layout, even when CSS makes it responsive:

HTML
<img src="/img/sneaker-800.avif" width="800" height="800" alt="Runner sneaker, side view" />
CSS
img {
  max-width: 100%;
  height: auto;
}
.video-embed {
  aspect-ratio: 16 / 9;
}

Ads, embeds and late UI

  • Reserve the slot with min-height (or aspect-ratio) for the most likely size, and keep the placeholder when nothing loads; collapsing an empty slot is a shift too.
  • Banners, cookie notices and promo bars: render them in the first HTML so their space exists from the start, or show them as an overlay (position: fixed at the bottom) that does not move the content. Inserting them at the top of the page after load pushes everything down.
  • If you cannot reserve space, put late content lower on the page: content inserted near the top moves more of the viewport.
  • Content that appears after a click is fine within 500 ms of the input. Content that loads on its own (infinite feeds, "recommended" blocks) should go into a fixed-size container or wait for a "Load more" click.

Fonts

When a web font replaces the fallback, text can change width and height. font-display: optional avoids the late swap; if you swap, match the fallback's metrics with size-adjust in @font-face (ascent-override and descent-override help too, but Safari does not support them yet) and preload the one or two fonts the first screen needs.

Animations and the back/forward cache

Animate transform instead of top, margin or height; transforms are not layout shifts. And keep the page eligible for the back/forward cache: a page restored from it appears as the user left it, without loading and shifting again.

Practise it

The platform's banner-layout-shift incident puts you on call for a product page where "Add to cart" moves while the page loads. In DevTools, turn on Layout Shift Regions in the Rendering drawer, record a reload in the Performance panel, and use the Layout shift culprits insight to see which element moved, by how much, and what caused it.

SeniorWeb platform

Fixing INP: long tasks, yielding, less work per interaction

Find the slow interactions in field data first (which element, which phase), then reproduce them in the Performance panel with CPU throttling and read the INP breakdown insight. Then fix the phase that dominates.

Input delay: keep the main thread free

Any task longer than 50 ms is a long task, and an input that arrives during it waits. The usual sources are script evaluation and during load, third-party tags, and timers doing heavy work. Ship and run less JavaScript at startup, split hydration (Suspense boundaries hydrate independently), and move non-urgent work out of the way.

Processing: do less, and yield

Show the result of the interaction first and do the rest later. Splitting work into several tasks gives the browser a chance to paint and to handle the next input in between:

JavaScript
function yieldToMain() {
  if (globalThis.scheduler?.yield) {
    return scheduler.yield();
  }
  return new Promise((resolve) => setTimeout(resolve, 0));
}

addToCartButton.addEventListener("click", async () => {
  cartBadge.textContent = String(cart.add(product));
  await yieldToMain();
  saveCartToStorage(cart);
  sendAnalytics("add_to_cart", product.id);
});

scheduler.yield() returns a promise, and its continuation runs before other queued tasks of the same priority, so your remaining work does not end up behind unrelated scripts the way a setTimeout(0) continuation can. MDN marks it as Limited availability: Chrome and Edge 129+, Firefox 142+, not yet Safari, hence the setTimeout fallback. In a long loop, yield every ~50 ms of work rather than after every item.

Presentation delay: make the next frame cheap

The frame after the handler has to recalculate style, lay out and paint. Keep the DOM small, avoid in handlers, prefer targeted updates to replacing big chunks of innerHTML, and use content-visibility for long off-screen content. The Reflow, repaint and layout thrashing topic covers these in detail.

React: avoid big re-renders per interaction

In React, processing time is mostly rendering. A keystroke that re-renders the whole page is the classic INP problem. The Typing lag challenge is a good place to practise measuring rendering work per interaction.

  • Keep state close to where it is used, so a change re-renders a small subtree.
  • Memoize expensive children (memo, useMemo, or React Compiler, stable since October 2025, which does it automatically).
  • Mark non-urgent updates with startTransition / useTransition, or derive a lagging value with useDeferredValue: the expensive list re-renders in the background and is interrupted by the next keystroke. The input's own value must stay a normal, urgent update.
  • Virtualize long lists instead of rendering thousands of rows.

On a product page, budget the variant picker and "Add to cart": each should update a small part of the page and defer analytics and storage.

SeniorInterview tips

Interview tips

  • Name the three metrics with what they measure and their thresholds. LCP (loading) ≤ 2.5 s, INP (responsiveness) ≤ 200 ms, CLS (visual stability) ≤ 0.1; poor above 4 s, 500 ms and 0.25. Add the rule that makes the numbers meaningful: assessed at the 75th percentile of page loads, separately for mobile and desktop.
  • Know the recent history. INP replaced FID on March 12, 2024, because FID measured only the input delay of the first interaction. Saying "FID" as a current metric is an easy way to sound out of date.
  • Explain how each number is built. LCP: candidates until the first interaction; the visible size counts. CLS: impact × distance per shift, grouped into session windows (gaps under 1 s, at most 5 s), worst window wins, shifts within 500 ms of input excluded. INP: worst interaction with one outlier ignored per 50, split into input delay, processing and presentation delay.
  • Separate field from lab. CrUX and RUM (web-vitals) decide what to fix; Lighthouse and the Performance panel help you reproduce and verify. Lighthouse has no INP on a page load; TBT is only a proxy. Mention that layout-shift entries exist only in Chromium.
  • Diagnose before fixing. For LCP, break it into TTFB, load delay, load duration and render delay and attack the largest. For INP, find the slow phase. For CLS, find the element that moved and why.
  • Tie fixes to the cause. Discoverable LCP image with fetchpriority="high", no lazy-loading above the fold; width/height or aspect-ratio, reserved slots for banners and ads; shorter tasks, scheduler.yield() with a fallback, smaller re-renders.
  • For a system design question (a product page, say), set a budget per metric and say how the design meets it: the server-rendered product photo as LCP, reserved space for price, reviews and promos, and an "Add to cart" handler that updates the badge first and defers the rest.

Misstatements to avoid: "CLS adds up every shift during the visit" (only the worst session window counts), "lab scores are what Google uses" (Core Web Vitals use field data), "will-change or a CDN fixes INP" (INP is main-thread work per interaction), and "a page without interactions has an INP of 0" (it has no INP).

JuniorReview checklist

What to check when reviewing code for Core Web Vitals

Use this list when you review a change you did not write (a teammate's pull request, a library's snippet or an AI assistant's suggestion) that touches the first screen, late-loading content or event handlers. A fast run on your laptop proves little: Core Web Vitals come from real users.

  • Do new images, videos and iframes have width and height or an aspect-ratio? Otherwise the box has no height until the file arrives, and everything below jumps. Layout Shift Regions in the DevTools Rendering drawer shows it.
  • Does content that loads on its own (an ad, an embed, a "recommended" block) have space reserved before it arrives? Look for a min-height or aspect-ratio slot that stays when nothing loads. The Performance panel's Layout shift culprits insight names the element that moved.
  • Is the LCP image a real <img> in the HTML, with fetchpriority="high" and no loading="lazy"? The cannot find images added by JavaScript or set in CSS, and lazy loading waits for layout. The LCP breakdown insight shows the slow part.
  • Does a click or key handler do all its work before the next paint? INP measures that wait. Update what the user sees first, then yield (scheduler.yield() or a setTimeout fallback) before storage or analytics; the INP breakdown insight shows the slow phase.
  • Does an animation move content with top, margin or height, or a web font change text size when it swaps in? Both can cause layout shifts. Animate transform instead; for fonts, use font-display: optional or size-adjust.
  • Does monitoring code use onLCP, onCLS and onINP, not FID? onFID is gone since web-vitals v5; a Lighthouse page-load run has no INP, only Total Blocking Time as a proxy.

Check your understanding

  • Practice

    Predict-output and open interview questions with self-assessment.

    2 predict-output · 3 open

  • Quiz

    Multiple-choice questions with explanations and a score.

    7 questions

Hands-on work that uses this topic.

Incident Simulator

Weekly Challenges