Part of the guide: Professional website development
SEO & Performance7 min read

Core Web Vitals explained: how to fix LCP, INP and CLS in React and Next.js

Core Web Vitals are three numbers that describe how a page feels to a real visitor: how fast the main content appears, how quickly it responds, and whether it jumps around. Here is how I measure and fix each one on React and Next.js sites.

Short answer

Core Web Vitals are LCP (good at 2.5 seconds or less), INP (good at 200 milliseconds or less) and CLS (good at 0.1 or less), measured on real users at the 75th percentile. In React and Next.js, most fixes come down to prioritising the hero image, handling fonts properly, shipping less JavaScript and reserving space for content.

01What are Core Web Vitals?

Core Web Vitals are Google's three user-experience metrics for page loading, responsiveness and visual stability. They feed into Google's page experience signals, but the better reason to care is that they track what visitors actually feel: a slow, laggy, jumpy page loses people before they read anything.

Google assesses each metric at the 75th percentile of real page loads, split by mobile and desktop. That means a page passes only if at least three quarters of visits hit the good threshold, so a fast developer laptop proves very little. Performance is one part of the broader checklist in my professional website development guide; this article goes deep on just this part.

  • Largest Contentful Paint (LCP): when the largest image or text block in the viewport finishes rendering. Good is 2.5 s or less, poor is over 4 s.
  • Interaction to Next Paint (INP): how long the page takes to visually respond to clicks, taps and key presses across the visit. Good is 200 ms or less, poor is over 500 ms. INP replaced First Input Delay in 2024.
  • Cumulative Layout Shift (CLS): how much visible content moves unexpectedly. Good is 0.1 or less, poor is over 0.25.

02How to measure Core Web Vitals: field data vs lab data

There are two kinds of data, and mixing them up is the most common mistake I see. Field data comes from real Chrome users, collected in the Chrome UX Report over a rolling 28-day window. Lab data comes from a single simulated load, such as a Lighthouse run. Google's assessment uses field data; lab data is a diagnostic tool.

PageSpeed Insights shows both on one page: the field data at the top (if the URL or origin has enough traffic) and a Lighthouse lab run below. Search Console's Core Web Vitals report groups URLs with similar problems, which is useful for finding which template is failing. For a new or low-traffic site there may be no field data at all, in which case lab data and your own real-user measurement are what you have.

  • Search Console Core Web Vitals report: which groups of URLs are failing in the field.
  • PageSpeed Insights: field and lab data for a specific URL, with diagnostics.
  • Chrome DevTools Performance panel: record a real interaction to find the slow task behind a bad INP.
  • Real-user monitoring: the web-vitals library, or the useReportWebVitals hook in Next.js, sending metrics to your analytics.

Because field data is a 28-day rolling window, a fix you deploy today will take weeks to fully show up in Search Console. Verify in the lab, then be patient.

03How to improve LCP in React and Next.js

On marketing and business websites, the LCP element is almost always the hero image or the main headline. The fix depends on which one it is and why it's late: slow server response, the resource being discovered late, the file being too large, or rendering being blocked.

In Next.js, use the Image component for the hero and tell the browser it matters. In Next.js 16 the old priority prop is deprecated; set loading to eager or fetchPriority to high on the LCP image, or use the new preload prop when the image needs to start loading from the document head. Never lazy-load the hero. Make sure the image is served in a modern format at the size it is actually displayed, using the sizes prop for responsive layouts.

Server response time matters as much as the image. Statically generated pages served from a CDN have a very short time to first byte. A page that waits on a slow database query or third-party API before sending any HTML will struggle to reach a good LCP whatever you do on the frontend.

  • Statically generate or cache pages wherever the content allows it.
  • Give the LCP image eager loading or high fetch priority, and never lazy-load it.
  • Serve correctly sized AVIF or WebP images with an accurate sizes attribute.
  • Avoid hero content that only appears after client-side JavaScript runs or a data fetch completes.
  • Inline or minimise render-blocking CSS, and avoid large CSS-in-JS runtimes on content pages.

04Fonts: the hidden cause of slow LCP and layout shifts

Web fonts affect two metrics at once. If text is hidden until the font downloads, a text LCP element is delayed. If text renders in a fallback font and then swaps to a font with different metrics, the whole layout shifts and CLS goes up.

The next/font module solves most of this: it self-hosts the font files at build time, so there is no extra connection to a font provider, and it generates a size-adjusted fallback so the swap barely moves anything. Load only the weights and subsets you actually use. On many sites I review, four or five font weights are downloaded and two are used.

  • Use next/font rather than a stylesheet link to a font provider.
  • Limit families, weights and character subsets to what the design needs.
  • Prefer a variable font when you need several weights.
  • Keep the default display: swap behaviour, or use optional for non-essential decorative fonts.

05How to fix INP: JavaScript, hydration and third-party scripts

INP is the metric React sites most often fail, because it measures what happens when the main thread is busy. Every interaction has to wait for whatever JavaScript is currently running. Large bundles, expensive re-renders and hydration of the whole page all keep the main thread occupied.

In the Next.js App Router, Server Components are the biggest lever. Content that never changes on the client does not need to ship JavaScript at all, so keep 'use client' boundaries as small and as low in the tree as you can. A marketing page where the entire layout is a client component hydrates far more than it needs to; one where only the menu, form and carousel are client components hydrates almost nothing.

For the interactions themselves, keep event handlers cheap. Update the visible state first and defer the expensive work. React's useTransition and useDeferredValue exist for exactly this: typing in a filter box should update the input immediately, and the filtered list can follow. Third-party scripts are the other usual suspect. Chat widgets, tag managers and heatmap tools each add main-thread work; load them with the Script component's lazyOnload or afterInteractive strategy, and remove the ones nobody looks at.

  • Move static content into Server Components and push client boundaries down to leaf components.
  • Code-split heavy, below-the-fold widgets with dynamic imports.
  • Use useTransition or useDeferredValue so expensive updates do not block input.
  • Avoid re-rendering large lists on every keystroke; memoise or virtualise them.
  • Audit third-party scripts and defer or remove what you can.

The fastest JavaScript is the JavaScript you never send. Before optimising a component, ask whether it needs to run in the browser at all.

06How to fix CLS: reserving space for everything

Layout shift happens when the browser places content and then has to move it because something above it changed size. The fix is always the same principle: reserve the space before the content arrives.

The Next.js Image component requires width and height (or fill inside a sized container) for this reason, so images rarely cause CLS when it is used properly. The usual culprits on React sites are elsewhere: cookie banners pushed in at the top of the page, embeds and ads without a fixed container, content that renders differently on the server and the client, and skeleton loaders that are a different height from the content that replaces them.

  • Always give images and video explicit dimensions or an aspect-ratio container.
  • Render cookie and announcement banners as overlays, or reserve their height in the layout.
  • Give embeds, iframes and ad slots a fixed minimum height.
  • Avoid hydration mismatches, such as rendering dates or user-specific content differently on server and client.
  • Animate with transform and opacity rather than properties that change layout.

07A Core Web Vitals workflow that actually sticks

Fixing Core Web Vitals once is easy; keeping them fixed is the hard part. New images get uploaded at full camera resolution, someone adds a marketing script, a new section becomes a client component. I treat performance like any other regression: measured on every significant change, not audited once a year.

When I rebuilt my own developer portfolio on server-rendered routes, the same change that gave every page complete HTML on first load also fixed its indexing problem, which I described in how I fixed Discovered – currently not indexed. The two problems are often connected: pages that render slowly on the client tend to render poorly for crawlers too. The same thinking applies to choosing between plain React and Next.js at the start of a project.

If your site is failing Core Web Vitals in Search Console and you'd like someone to find and fix the cause, that's exactly what my website performance and SEO optimization service covers. For new builds, performance is planned in from the start of the website development process.

  • Check Search Console monthly and investigate any URL group that moves out of good.
  • Run Lighthouse on key templates before each release.
  • Collect real-user metrics in production so you are not waiting 28 days to see a regression.
  • Set image upload limits and automatic resizing in the CMS.
  • Require a reason for every new third-party script.
TopicsCore Web Vitalsimprove LCPINP optimizationfix CLSNext.js performancePageSpeed Insights

FAQ

Quick answers

LCP of 2.5 seconds or less, INP of 200 milliseconds or less and CLS of 0.1 or less, measured at the 75th percentile of real page loads on mobile and desktop.

Search Console uses field data from real users over a 28-day window, while the Lighthouse score in PageSpeed Insights comes from one simulated lab load. Field data is what Google assesses, and it changes slowly after a fix.

They are part of Google's page experience signals, but relevant, helpful content matters far more. Good Core Web Vitals will not rescue weak content, though poor ones can cost you visitors who leave before the page loads.

No. Next.js provides the tools, such as static generation, Server Components, next/image and next/font, but a site can still fail by shipping too much client JavaScript, heavy third-party scripts or unsized content.

Interaction to Next Paint replaced First Input Delay as a Core Web Vital in March 2024. INP measures responsiveness across all interactions during a visit, not just the first one.

Keep reading

All articles

Projects behind this article

The production systems where these decisions were made.

All case studies
  • Muhammad Qasim Developer Portfolio — Developer portfolio project preview
    Developer portfolioSEO portfolio

    Muhammad Qasim Developer Portfolio

    A developer portfolio for Muhammad Qasim showcasing SaaS, CRM, dashboard, AI automation and production work …

    Read case studyLive
  • CallLoom Landing Page — Landing page project preview
    Landing pageSaaS marketing website

    CallLoom Landing Page

    A Next.js marketing landing page for an inbound call tracking system, covering features, pricing and convers…

    Read case studyLive
  • CareWinners Care Service Platform — Caregiver marketplace project preview
    Caregiver marketplaceSaaS platform

    CareWinners Care Service Platform

    A US care service SaaS connecting care seekers with caregivers for childcare, elderly and home support, with…

    Read case studyLive
  • Spendora Expense Tracker App — Mobile app project preview
    Mobile appPersonal finance

    Spendora Expense Tracker App

    Spendora is an Android expense tracker and budget app built with Expo React Native and Django: income, expen…

    Read case studyLive

Related services

If this describes a problem you have right now, these are the ways I can help.

All services
  • Performance & SEO

    A site that Google cannot render is a site Google will not rank. Most technical SEO failures I find are not content …

    Explore service
  • React Development

    Most React problems are not React problems — they are structure problems. I build frontends with a component system,…

    Explore service
  • Web Development

    A website that just looks right is not the same as one that loads fast, ranks, and holds up once real traffic and re…

    Explore service
  • CRM Development

    Off-the-shelf CRMs force your team to work the way the software wants. I build CRM systems around the workflow you a…

    Explore service