[Performance]

27 Jul 2025

-

2 min read time

How to Optimize Core Web Vitals in NextJS App Router for 2025

Unlock faster, smoother Next.js apps by mastering Core Web Vitals: LCP, INP, and CLS. Learn advanced tactics like reducing runtime overhead, streaming with React Server Components, smart image handling, and optimizing third-party scripts to boost UX and SEO.

Mateusz Koncikowski

By Mateusz Koncikowski

How to Optimize Core Web Vitals in NextJS App Router for 2025

Optimizing Core Web Vitals in Next.js App Router: A Deep Dive

By the end of this article, you’ll know how to tackle Largest Contentful Paint (LCP), Interaction to Next Paint (INP) and Cumulative Layout Shift (CLS) in your Next.js App Router project—while uncovering hidden bottlenecks and advanced tactics the top guides often skip.

What Are Core Web Vitals and Why They Matter

Core Web Vitals are a set of metrics defined by Google’s Search Central documentation that measure real-world user experience on the web.

  • LCP tracks how quickly the largest content element becomes visible.

  • INP gauges responsiveness when users interact.

  • CLS monitors unexpected layout movements.

Image

53% of mobile visitors abandon a site if it takes over three seconds to load[^1]. Improving these metrics not only helps your rankings but keeps visitors engaged.

Reducing Next.js Runtime Overhead

Even a minimal Next.js App Router build ships roughly 87 KB of client-side runtime before your code runs. That baseline can delay the first paint and add to INP.

Addressing Framework Runtime Overhead

  • Audit your client bundle with the Next.js Analyzer .

  • Remove unused polyfills or features (e.g., Image Optimization only if you don’t use `<Image />`).

Largest Contentful Paint (LCP) Tactics

LCP often ties back to images, fonts or server response times.

  • Use the built-in `<Image />` component for auto-optimization and sizing, as detailed in this LogRocket guide to Next.js Image .

  • Prioritize critical fonts using `font-display: swap`, which ensures that text remains visible during font loading ( CSS-Tricks guide to font-display ).

  • Apply `placeholder="blur"` to reserve space and display a low-res preview, preventing layout shifts during image load.

Tactic

Benefit

Documentation Link

`<Image />` optimization

Auto-optimizes and sizes images for faster load and better LCP

LogRocket Next.js Image Guide

`font-display: swap`

Ensures text remains visible during font loading, improving LCP

CSS-Tricks font-display Guide

`placeholder="blur"`

Prevents layout shifts by reserving space and showing a preview

LogRocket Next.js Image Guide

Every millisecond contributes to user satisfaction.

– Google Chrome Team

Interaction to Next Paint (INP) Strategies

Making clicks and taps feel instant requires shaving milliseconds off your main thread.

  • Shift as much code as you can into Server Components, reducing the client JavaScript payload ( Introduction to React Server Components ).

  • Avoid overusing React Context for global state in large apps—each consumer re-renders when context value changes, causing main-thread spikes[^4].

Streaming with React Server Components

Next.js App Router supports React’s streaming API. That means the browser can start rendering parts of your page as soon as they’re ready, rather than waiting for all data.

  // app/page.jsx

export default async function Page() {

  const products = await fetch('/api/products').then(r => r.json())

  return (

    <>

      <Header />

      <React.Suspense fallback={<Loading />}>

        <ProductList products={products} />

      </React.Suspense>

    </>

  )

}

Streaming can lower Time to First Byte and make interactions feel snappier.

Minimizing Cumulative Layout Shift (CLS)

Unexpected shifts frustrate visitors. By understanding the causes of Cumulative Layout Shift, you can apply proper space reservation ( Smashing Magazine on CLS ).

  • Always specify `width` and `height` (or `aspectRatio`) on images.

  • Reserve space for dynamic content (notifications, embeds, ads).

  • Use CSS `min-height` or flexbox containers to avoid collapse.

Optimizing Third-Party Scripts and Fonts

Third-party code can block rendering and inflate JavaScript execution time.

Advanced Speed Techniques

These are often missing in basic guides but can yield real gains.

  1. Prefetch Navigation Data

    `<Link prefetch={true}>` fetches route code and data on hover or viewport entry, cutting wait time when users click.[^6]

  2. Deep Bundle Inspection

    Beyond code splitting, use:

    - Webpack Bundle Analyzer

    - Source Map Explorer

    - Next.js’s built-in analyzer to pinpoint large dependencies.

Technique

Implementation

Tools/Links

Prefetch Navigation Data

`<Link prefetch={true}>` to prefetch code and data

Next.js Link Docs

Deep Bundle Inspection

Analyze bundles beyond standard code splitting

Webpack Bundle Analyzer , Source Map Explorer , Next.js Bundle Analyzer

Monitoring, Debugging, Iterating

Continuous measurement is key.

  • Implement CI-based performance testing using tools like Calibre to catch regressions early.

  • Check real-user metrics in Google Analytics or the Chrome User Experience Report.

  • Keep an eye on regressions whenever you merge new features.

Image

Your Next.js App on the Fast Track

By applying these basics alongside runtime audits, streaming, prefetching and bundle analysis, you’ll push your Core Web Vitals into green—even as your app scales. Start measuring today and iterate often: small wins add up to a noticeably smoother experience for your users.

Mateusz Koncikowski

By Mateusz Koncikowski

More from our Blog

Keep reading