Mobile & DevOps

Next.js Core Web Vitals: Fixes That Moved the Needle

The Next.js changes that reliably improve LCP, INP and CLS, ordered by impact, with notes from building a data-heavy App Router SaaS.

By Devang GandhiUpdated Nov 3, 20267 min read

Teams searching for "nextjs core web vitals" fixes usually start by chasing a Lighthouse number on their own laptop. That number is not what Google uses, and it is not what your users feel. The real score comes from field data on mid-range phones and patchy mobile networks.

This post lists the Next.js changes that reliably improve Largest Contentful Paint, Interaction to Next Paint and Cumulative Layout Shift, roughly in order of impact. It draws on building Client Mitra, a data-heavy App Router SaaS that also runs inside Android and iOS apps, where slow pages are impossible to hide.

TL;DR

Measure field data first. Fix LCP with a properly prioritized hero image, self-hosted fonts and faster server responses. Fix INP by moving work into server components, shrinking client bundles and breaking up long tasks. Fix CLS by reserving space for images, fonts and late content. Then defer every third-party script you can.

key takeaways

  • Measure field data first, because lab scores from one fast laptop rarely match what real users on mid-range phones experience.
  • LCP usually improves most from fixing the hero image, fonts and server response time, not from micro-optimizing JavaScript.
  • INP problems come from heavy client components and long tasks, so moving work to server components and splitting bundles matters.
  • CLS is almost always caused by images without dimensions, late-loading fonts and content injected above existing content.

Measure before you change anything

Google's thresholds for good are LCP under 2.5 s, INP under 200 ms and CLS under 0.1, at the 75th percentile of visits. The web.dev Core Web Vitals guide explains each metric in depth.

Where to get real data:

  1. Search Console's Core Web Vitals report for public pages, grouped by URL pattern.
  2. PageSpeed Insights for a URL's field data (from the Chrome UX Report) alongside a lab run.
  3. Your own RUM using Next.js's useReportWebVitals hook, sending metrics to analytics with the route name attached.

Your own collection is the most useful, because it covers logged-in pages and tells you which route is slow, not just that the site is.

Fixes that move LCP

LCP is the time until the largest visible element, usually a hero image or a heading, is painted.

Cause Fix in Next.js
Hero image discovered late Use next/image with priority on the LCP image only
Oversized images Set sizes correctly so phones do not download desktop widths
Web fonts blocking text Use next/font to self-host with display: swap and preloading
Slow server response (TTFB) Cache data fetches, avoid waterfalls, colocate server and database
Client-side data fetching for above-the-fold content Fetch in a server component so HTML arrives with content
Huge CSS Tailwind's purge plus avoiding global CSS imports from many libraries

Two notes from experience. First, priority on every image defeats its purpose, so pick the one LCP element per page. Second, server response time is often the biggest hidden factor. A server in a different region from the database adds latency to every request before the browser sees a byte.

Fixes that move INP

INP measures how long the page takes to respond visually after a tap, click or keypress. It replaced First Input Delay and is harder to pass, especially on dashboards.

  • Ship less JavaScript. Default to server components. Add "use client" only to the interactive leaf, not to the whole page.
  • Split heavy components. Charts, rich text editors, PDF previews and date pickers belong behind next/dynamic so they load when needed.
  • Avoid giant re-renders. A filter change that re-renders a 500-row table on the main thread will fail INP. Virtualize long lists and memoize row components.
  • Yield during heavy work. Break long loops into chunks, or move parsing and calculations to a web worker.
  • Give instant feedback. Use useTransition for state updates that trigger expensive renders, so the button press paints immediately.
  • Audit libraries. Check bundle composition with @next/bundle-analyzer. A single date or icon library imported wholesale can dominate the bundle.

Fixes that move CLS

CLS measures unexpected layout movement. It is usually the easiest to fix.

  1. Always give images and videos dimensions, or use next/image, which reserves space automatically.
  2. Use next/font so fallback and web font metrics are matched and text does not jump on swap.
  3. Reserve space for banners, cookie notices and ads, or render them as overlays.
  4. Render skeletons with the same height as the real content for data that loads after the first paint.
  5. Never insert content above what the user is reading, except in response to their action.

Third-party scripts

Analytics, chat widgets, heatmaps and ad pixels quietly hurt all three metrics. Load them with next/script using afterInteractive or lazyOnload, remove the ones nobody looks at, and test with them disabled to see their real cost.

How I built this in practice

Client Mitra is a multi-tenant CRM for Indian photography studios that I built solo on the Next.js App Router with Tailwind, a Node/Express API and MongoDB. It has around 30 app pages covering enquiries, bookings, a crew calendar for multi-day weddings, GST invoices and reports. The same web app ships as native Android and iOS apps through a Flutter wrapper, so studio owners on mid-range phones are the real audience for performance.

A few choices did the heavy lifting. TanStack Query with a persisted cache means returning users see their last data instantly while fresh data loads in the background, which helps perceived speed on every revisit. Uploaded images such as business logos live on Cloudinary, which can deliver resized versions instead of full originals. Heavy pieces like reports and calendars load only on the pages that need them, and client components stay at the leaves.

I did not chase a perfect lab score. I watched how screens behaved on real phones inside the app wrapper and fixed the interactions that felt slow, which is what INP is trying to measure anyway.

Common mistakes

  • Optimizing for a desktop Lighthouse run instead of mobile field data.
  • Adding priority to every image, which makes none of them a priority.
  • Marking entire pages as client components because one button needs state.
  • Fetching above-the-fold data on the client and showing spinners where HTML could have arrived ready.
  • Loading chat widgets and pixels synchronously in the root layout.
  • Ignoring logged-in pages, where users spend most of their time.

keep reading

FAQ

What are good Core Web Vitals scores for a Next.js site?+

Google's thresholds for good are LCP under 2.5 seconds, INP under 200 milliseconds and CLS under 0.1, measured at the 75th percentile of real user visits. Those thresholds are the same for Next.js as for any other site.

Does the App Router improve Core Web Vitals?+

It can, because server components send less JavaScript to the browser and streaming shows content sooner. But a page full of client components and heavy libraries will still be slow, so the router alone is not a fix.

Why is my Lighthouse score good but Search Console says pages are poor?+

Lighthouse is a lab test on one device and network. Search Console uses field data from real users, often on slower phones and connections, so it exposes problems a fast development machine hides.

Do third-party scripts hurt Next.js performance?+

Yes, often more than your own code. Load analytics, chat widgets and pixels with next/script using the afterInteractive or lazyOnload strategies, and remove any you are not actively using.

Should I fix Core Web Vitals on dashboard pages behind login?+

Search ranking only uses public pages, but logged-in users feel the same slowness. Prioritize public pages for SEO and fix dashboard INP for retention.

Devang Gandhi

AI & full stack developer at Passdn, building CRMs, SaaS, AI agents and Flutter apps for clients in the US, UK, Australia, UAE and India. More about me

Read next

More in Mobile & DevOps