Skip to content
Sandeep Kumar
Updated 5 min read

How to fix Largest Contentful Paint in Next.js

LCP is usually one element and one slow step. How to find both in Next.js: the image, the font, the server response, and the render path that delays them.

Sandeep Kumar, Full-stack EngineerSandeep KumarFull-stack Engineer
On this page
  1. LCP is one element, not a page score
  2. Four sub-parts, four different fixes
  3. Time to first byte
  4. Resource load delay: stop hiding the hero
  5. Resource load time: serve the right bytes
  6. Render delay, which is where the week goes
  7. Lab tests the change, field decides if it mattered
  8. Keeping it narrow

Largest Contentful Paint is the Core Web Vital people most often try to fix by guessing. They compress every image, defer every script, and the number barely moves, because LCP measures one element and the work went somewhere else.

This is how to find that element, work out which part of its journey is slow, and fix that part specifically, in a Next.js App Router app.

LCP is one element, not a page score

It is the render time of the largest content block visible in the viewport. Usually a hero image, a large heading, or the first paragraph of text. Not the whole page, and not the last thing to finish loading.

Find it before you change anything. PageSpeed Insights names the element outright. In DevTools, the Performance panel marks it with an LCP badge and hovering highlights the node.

If it turns out to be a heading, every minute you spend on image formats is wasted. That sounds too obvious to be worth saying, and it is the single most common failure in LCP work.

Four sub-parts, four different fixes

Google splits LCP into four, and what you do about each one has almost nothing in common with the others.

Sub-part What it is Typical cause
Time to first byte Server response Dynamic rendering, slow upstream, cold start
Resource load delay Gap between first byte and fetch starting Discovered late, blocked, lazy-loaded
Resource load time The download itself Oversized image, no modern format
Render delay Downloaded but not yet painted Blocking CSS, fonts, hydration

Measure before choosing. If TTFB is 1.8s, image optimisation is irrelevant to you. If render delay dominates, file size is not your problem and compressing things harder will not move the number at all.

Time to first byte

The fastest response is one that was rendered before the request arrived. A route is static unless something opts it out: reading cookies() or headers(), using searchParams, or a fetch that is explicitly uncached.

app/blog/[slug]/page.tsxts
export const revalidate = 3600;          // ISR: static HTML, refreshed hourly

export function generateStaticParams() {  // prerender every post at build time
  return getAllPosts().map((p) => ({ slug: p.slug }));
}

Then check what you shipped rather than what you intended. next build prints a symbol per route: ○ static, ● prerendered with params, ƒ rendered per request. A ƒ on a content page is almost always an accident, because one cookies() call deep inside a shared component opts the entire route out and nothing warns you.

The caching rules underneath this changed in Next.js 15 and again in 16, so if your mental model predates that, the current model is here.

Resource load delay: stop hiding the hero

next/image lazy-loads by default. Correct for everything below the fold, wrong for the LCP element, because the browser will not fetch it until layout says it is near the viewport. That is after CSS, after layout, long after the fetch could have started.

tsx
import Image from "next/image";
import hero from "../public/hero.webp";

<Image
  src={hero}
  alt="…"
  loading="eager"            // do not wait for layout to decide
  fetchPriority="high"       // and fetch it ahead of the rest
  sizes="(min-width: 1024px) 50vw, 100vw"
  className="w-full"
/>

If you learned this as priority, that prop is deprecated as of Next.js 16 in favour of preload, and the docs now steer you to loading="eager" or fetchPriority="high" for most cases rather than to preload at all. preload={true} still does the strongest thing available, emitting a <link rel="preload"> so the fetch begins during HTML parsing:

tsx
<Image src={hero} alt="…" preload sizes="…" />

Whichever of the three you use, one image per page. Marking several defeats the point, since preloading everything prioritises nothing.

Resource load time: serve the right bytes

Once the fetch starts promptly, only size is left.

Let next/image re-encode, because it serves AVIF or WebP by format negotiation and a 650 KB PNG routinely comes out at tens of kilobytes with no visible difference. Set sizes honestly, because without it the browser assumes 100vw and hands a 390px phone a desktop-width image.

And check the quality you are actually serving, because Next.js 16 changed this and it catches people. The default for images.qualities is now [75] rather than allowing anything. A quality prop outside that list is not ignored and does not fall back to the default: it is coerced to the closest allowed value, so with qualities: [50, 75, 100] a quality of 80 is served as 75. Development logs a warning, and a direct /_next/image request with an unlisted q returns a 400. So add the values you want to the config and read the rendered srcset to confirm the q= parameter is what you think.

next.config.tsts
images: { qualities: [50, 75, 100] },

It is one of several Next.js 16 changes that bite quietly.

Render delay, which is where the week goes

The element has arrived and still is not painted. This is the sub-part people skip, and it is the one that most often dominates.

Fonts block text. If the LCP element is a heading, a web font is standing in front of it. next/font self-hosts and preloads, removing a third-party round trip, and display: "swap" paints in a fallback immediately instead of holding the text invisible.

ts
import { Inter } from "next/font/google";
export const inter = Inter({ subsets: ["latin"], display: "swap" });

Hydration blocks everything. If the LCP element sits inside a "use client" component that renders nothing until mounted, paint waits for JavaScript to download, parse and run. Keep the hero on the server and push "use client" down to the interactive leaves.

And blocking CSS and scripts do what they say. A stylesheet in the head blocks rendering by design; third-party scripts have no business in that path at all, and next/script with afterInteractive or lazyOnload moves them out of it.

Lab tests the change, field decides if it mattered

A Lighthouse run is one load on one machine at one network speed. That is a useful experiment and not a measurement of your users.

Use the lab to test a single lever, re-run, compare. Use Search Console and the Chrome UX Report for the 75th percentile of real visits, which is what Google assesses. The two will disagree at some point, and when they do, the field data wins.

Keeping it narrow

LCP work succeeds when it refuses to be general. Identify the element, split the number into four parts, fix the part that dominates, and leave the other three alone.

In Next.js that usually comes down to three things. Render the route statically so the HTML arrives fast. Mark exactly one image eager and high-priority so it is discovered immediately. Keep the hero out of any client component that would make paint wait on hydration.

Everything past that is tuning, and tuning the wrong sub-part is precisely how a week disappears with the number unchanged.

Frequently asked

What is a good Largest Contentful Paint score?

Google's threshold is 2.5 seconds or less at the 75th percentile of real users, measured on mobile. Between 2.5 and 4 seconds needs improvement, and above 4 seconds is poor. The 75th percentile matters because it means a quarter of your visitors can be slower than your target while the page still passes.

Which element is my LCP element?

Whichever block of content is largest in the viewport when loading finishes: usually a hero image, a heading, or a block of text. Chrome DevTools marks it in the Performance panel, and PageSpeed Insights names it directly. Identify it before optimising, because work done on any other element will not move the number.

Why is my LCP slow when the image is small?

Because LCP is not only download time. It includes the server response, the delay before the browser discovers the resource, and the render delay after it arrives. A small image that is discovered late, blocked by a stylesheet, or rendered by a client component that must hydrate first can produce a worse LCP than a large image loaded immediately.

Does next/image improve LCP automatically?

Partly. It serves modern formats and correct sizes, which cuts download time, but it lazy-loads by default. On the LCP element that is actively harmful, because the browser defers the fetch. Set loading="eager" and fetchPriority="high" on the one above-the-fold image, or preload for a real <link rel=preload>. The older priority prop is deprecated in Next.js 16.

Found this useful?Share on XShare on LinkedIn

Related reading