Skip to content
Web Development

How to Improve Largest Contentful Paint (LCP)

How to improve Largest Contentful Paint: find the LCP element, see where its time goes, then fix lazy-loading, priority, render-blocking CSS and slow servers.

Keshur Gojiya

7 min read

How to Improve Largest Contentful Paint (LCP)

To improve Largest Contentful Paint (LCP), first find out which element is the LCP on your slow pages, usually a hero image or a large heading. Then make sure the browser finds it in the HTML, downloads it early and paints it straight away: don't lazy-load the hero image, mark it with fetchpriority="high", keep render-blocking CSS and scripts small, serve a correctly sized modern image and get the HTML from the server quickly. Fix discovery and priority first; they often matter more than squeezing a few more kilobytes out of the image.

What does Largest Contentful Paint measure?

Largest Contentful Paint is the time from when a visitor starts loading a page until the largest image or block of text in the viewport is rendered. It is one of Google's three Core Web Vitals, and the closest single number to "when did this page look ready?"

The LCP element can be an image, a video, an element with a CSS background image, or a block of text such as a heading or paragraph.

Google's thresholds are:

  • Good: 2.5 seconds or less
  • Needs improvement: over 2.5 seconds, up to 4 seconds
  • Poor: over 4 seconds

LCP is judged at the 75th percentile of page loads, separately for mobile and desktop. In plain terms, at least three out of four visits need an LCP of 2.5 seconds or less for the page to pass.

How to find your LCP element

The LCP element often differs by device (a heading on a phone, a hero photo on a laptop), so check both.

  1. PageSpeed Insights. The top section shows field data from real Chrome users, if the page or site has enough traffic. The Lighthouse lab test below it has LCP breakdown and LCP request discovery insights that name the element and show where the time went.
  2. Chrome DevTools. The Performance panel's live metrics show your local LCP element; hover over it to highlight it on the page. Record a throttled reload for the full trace.
  3. Search Console. The Core Web Vitals report groups failing URLs, which shows which page templates to fix first.

Lab data vs field data: which LCP number counts?

Field data comes from real Chrome visits, and it is what the Core Web Vitals assessment in PageSpeed Insights and Search Console use. Lab data is one simulated load: ideal for debugging and testing a fix, but not what your visitors get.

When the two disagree, trust the field data and look for what the lab misses: slower phones, distant visitors, cookie banners, logged-in pages and A/B testing scripts. Field data is a rolling 28-day window, so a fix takes about four weeks to show in full.

The four parts of LCP

Google's web.dev guidance splits LCP into four sub-parts, and the largest one tells you which fix to make.

  • Time to first byte (TTFB): until the first byte of the HTML arrives.
  • Resource load delay: from TTFB until the browser starts downloading the LCP image.
  • Resource load duration: how long the image takes to download.
  • Element render delay: from the end of the download until the element is painted.

As a rough guide, web.dev suggests about 40% each for TTFB and load duration, and under 10% each for the two delays, which are mostly wasted time. A text LCP has no file to download, so it is only TTFB plus render delay.

How to improve LCP, fix by fix

Start with the largest sub-part on your page. Without that data, this order usually has the most effect.

1. Stop lazy-loading the hero image

loading="lazy" makes the browser wait until the image is near the viewport, which means waiting for layout first: exactly wrong for the first thing visitors see. Script-based lazy loading that hides the real URL in a data-src attribute is worse, because nothing loads until JavaScript runs. Watch for optimisation plugins, slider scripts and image components that lazy-load everything by default.

2. Put the image in the HTML with fetchpriority="high"

The browser can only start fetching early what it finds in the HTML. Use a normal <img> with src and srcset in the markup the server sends, and add fetchpriority="high" so it is fetched ahead of other images.

<img
  src="/images/hero-1200.webp"
  srcset="/images/hero-640.webp 640w, /images/hero-1200.webp 1200w, /images/hero-1920.webp 1920w"
  sizes="100vw"
  width="1920" height="1080"
  alt="Team planning a project around a table"
  fetchpriority="high">

fetchpriority works in all current major browsers, and older ones ignore it. Use it on the one image most likely to be the LCP; marking several images as high priority defeats the purpose.

3. Render the hero on the server, not in the browser

With client-side rendering, the HTML arrives nearly empty and the hero appears only after JavaScript downloads, runs and perhaps fetches data. Server-side rendering or prerendering puts the hero in the first HTML response. JavaScript-built sliders, and A/B testing tools that hide the page until an experiment is chosen, cause the same delay.

4. Preload an image the browser discovers late

When the hero is a CSS background image or is inserted by JavaScript, the browser only finds it after processing that CSS or script. Preload it from the <head> so the download starts with the HTML:

<link rel="preload" as="image" href="/images/hero-bg.webp" type="image/webp" fetchpriority="high">

Preload only the above-the-fold image, with the exact URL the page uses; an unused preload wastes bandwidth, and Chrome flags it in the console.

5. Clear render-blocking CSS, scripts and fonts

Even after the image arrives, the browser won't paint until stylesheets and synchronous scripts in the <head> have loaded. Add defer to those scripts, remove unused CSS, inline critical CSS only when it is small, and load third-party widgets after the main content. For a text LCP, add font-display: swap to your @font-face rules so the text shows in a fallback font while the web font loads.

6. Serve a right-sized, modern image

Load duration is mostly file size and distance. Export the hero at the sizes it is displayed at, list them in srcset with an accurate sizes value so phones don't download the desktop file, use WebP or AVIF, and compress. A CDN shortens the distance, and serving the image from the same origin as the page avoids an extra connection to another domain.

7. Reduce server response time

Everything waits for the HTML. Slow TTFB usually comes from redirect chains (http to https to www), pages a CMS builds from the database on every request, a server far from your visitors, or CDN caches bypassed by tracking parameters in the URL. Link straight to final URLs, cache full pages at the CDN or serve prerendered pages, and host close to your audience.

When I fix LCP as part of website maintenance work, I start the same way: find the element on the failing templates, read the four sub-parts, fix the largest.

Next.js and WordPress specifics

Next.js: next/image lazy-loads by default. For the hero on Next.js 16 and later, set loading="eager" with fetchPriority="high"; on earlier versions, the priority prop does this job (it is deprecated from version 16). A hero that loads its content in useEffect loses the benefit of server rendering.

WordPress: since version 6.3, WordPress adds fetchpriority="high" to the image it judges most likely to be the LCP and avoids lazy-loading the first images on the page. It is a guess, though, and page-builder background heroes, sliders and lazy-loading plugins can bypass it, so check your rendered HTML.

FAQ

What is a good Largest Contentful Paint score?

A good LCP is 2.5 seconds or less, measured at the 75th percentile of real page loads, separately on mobile and desktop. Between 2.5 and 4 seconds needs improvement, and anything over 4 seconds is poor.

Why is my LCP good in Lighthouse but poor in Search Console?

Lighthouse runs one simulated load, while Search Console reports real Chrome visits on real phones and connections. Fix what the field data shows, and use the lab test to confirm each fix.

Does LCP affect SEO?

LCP is one of the Core Web Vitals, and Google says good Core Web Vitals align with what its core ranking systems seek to reward. Relevance still comes first, so a fast page won't outrank a more useful one; the bigger cost of a slow LCP is visitors who leave.

Key takeaways

  • Find the LCP element for each template and device first, and see which of its four parts is largest.
  • Never lazy-load the hero image: put it in the server-sent HTML with fetchpriority="high", and preload it only when the browser would find it late.
  • Then clear render-blocking CSS, scripts and fonts, right-size the image and speed up the server.
  • Judge success by field data at the 75th percentile, 2.5 seconds or less, not by one lab run.

Tags

  • Web Performance
  • SEO
  • Tutorials
  • Next.js

About Keshur Gojiya

Web developer and HTML email specialist with 6+ years of experience, building websites and emails for businesses, startups and agencies.

Get to know me
Keep Reading
View All Articles
  • Web Development

    7 min read

    WordPress to Next.js Migration Checklist: 6 Stages in Order

    A WordPress to Next.js migration checklist in six stages: audit, build, redirects, staging QA, launch day and the first weeks, so nothing gets lost.

    • WordPress Migration
    • Next.js
    Keshur Gojiya
  • Web Development

    6 min read

    How to Hire a Next.js Developer: What to Check and Ask

    How to hire a Next.js developer: what to check in their work, questions to ask before you sign, red flags, freelancer vs agency, and how to write a clear brief.

    • Next.js
    • Best Practices
    Keshur Gojiya
  • Web Development

    7 min read

    Is a Headless CMS Good for SEO? What to Set Up

    Is a headless CMS good for SEO? Yes, if the site is built right. The checklist: rendering, SEO fields, URLs, sitemaps, redirects, images and page speed.

    • SEO
    • Sanity CMS
    Keshur Gojiya

Need help with an email or website?

If an email is breaking in Outlook or dark mode, or you have a design that needs building, tell me about it and I’ll reply with next steps.

Email me