Skip to content
Tutorials Center
My learning

Topics

Lesson 6 of 37 ยท Metrics and Core Web Vitals

Largest Contentful Paint (LCP)

Learn what Largest Contentful Paint measures, which elements count, its four timing parts, and practical fixes for slow server responses, late images and render delay.

Largest Contentful Paint (LCP) reports when the largest image, text block or video in the visible viewport finished rendering. It is the closest simple metric to "when did the page look loaded?". A good LCP is 2.5 seconds or less at the 75th percentile.

In this lesson you will learn which elements are candidates, how to break an LCP into four parts so you know what to fix, and the changes that usually give the largest wins.

What counts as the LCP element

The browser tracks these element types and picks the largest visible one:

  • <img> elements (including inside <picture>)
  • <image> inside SVG
  • <video> with a poster image
  • Elements with a CSS background-image loaded through url()
  • Block-level elements containing text

"Largest" means the biggest area visible in the viewport, after cropping. During load the candidate can change: a heading might be first, then a hero photo replaces it. The browser stops updating when the user interacts or the page is backgrounded.

On many pages the LCP is an image. On article pages it is often the headline or first paragraph.

The four parts of LCP

Any LCP time splits into four sequential parts. Finding the biggest one tells you where to work.

flowchart LR
  A["TTFB"] --> B["Resource load delay"]
  B --> C["Resource load duration"]
  C --> D["Element render delay"]

LCP = time to first byte + load delay + load duration + render delay.

Part What happens Typical culprit
TTFB Wait for the HTML Slow server, redirects, no CDN
Resource load delay Time before the browser starts fetching the image Image discovered late (set by JS, lazy-loaded, in CSS)
Resource load duration Downloading the image Huge file, wrong format, slow network
Element render delay From downloaded to painted Render-blocking CSS/JS, busy main thread

A well-tuned page spends most of the time on the actual image download and almost none on delay.

Reading the LCP element

Find the LCP element and size

Real LCP entries also include url (for images), loadTime and renderTime, which let you compute the four parts yourself.

Fixes by part

Cut TTFB

Serve HTML from a CDN or cache, remove redirect chains, speed up database queries and use compression. A page that waits one second for HTML starts one second behind everything else.

Make the image discoverable early

The browser can fetch an image only after it finds it. Put the hero image in the HTML as a plain <img src> instead of setting it with JavaScript or CSS, and do not lazy-load it. Raise its priority with fetchpriority="high":

HTML
<img src="/img/hero.avif" width="1200" height="600"
     fetchpriority="high" alt="A mountain lake at sunrise">

If it must be a CSS background, add a <link rel="preload" as="image"> in the head (see resource hints).

Shrink the download

Use a modern format, the right dimensions and compression (image formats and sizes). A hero image sent at 4000 px wide to a 390 px phone wastes most of its bytes.

Remove render delay

Inline critical CSS, defer scripts (how browsers render pages) and avoid fonts that hide text until they load (web fonts).

Never put loading="lazy" on the LCP image. It tells the browser to delay the exact image that matters most.

Simulating the four parts

This stand-in computes the four parts from sample numbers, the way a monitoring tool would.

JS Break an LCP into parts

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Here the image took 800 ms to be requested after the HTML arrived: the discovery problem. The fix is an earlier hint, not a smaller file.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Which is NOT a typical LCP candidate?

    Only visible elements within the viewport can be the LCP element.
  2. 2. Which attribute helps the hero image load earlier?

    fetchpriority="high" raises the request priority for the important image.
  3. 3. A large gap between TTFB and the image request starting points to

    That gap is the resource load delay, often caused by JavaScript-inserted or lazy-loaded images.
  4. 4. What is the good LCP threshold?

    2.5 seconds at the 75th percentile is rated good.

Summary

  • LCP marks when the largest visible image or text block painted; aim for 2.5 s at p75.
  • Split it into TTFB, load delay, load duration and render delay, then fix the biggest.
  • Make the hero image discoverable in HTML, give it high priority and never lazy-load it.
  • Keep it small, modern and free of render-blocking work.

Next: Interaction to Next Paint