Largest Contentful Paint (LCP)

How to diagnose and optimize Largest Contentful Paint by breaking it into TTFB, resource load delay, resource load duration, and element render delay.

What LCP Measures

Largest Contentful Paint (LCP) reports the render time of the largest image, video poster, or block-level text element visible within the initial viewport. To pass Core Web Vitals, at least 75% of page visits must record an LCP of 2.5 seconds or less.

The Four Sub-Parts of LCP

Optimizing LCP systematically requires breaking total LCP duration into four sequential phases:

Sub-Part Target Share Primary Bottlenecks
1. Time to First Byte (TTFB) ~40% (≤ 800ms) Uncached origin HTML, slow database queries, redirect chains
2. Resource Load Delay < 10% (~0ms) Hero image hidden in CSS background-image, late JS injection, or loading="lazy"
3. Resource Load Duration ~40% (≤ 1000ms) Oversized unoptimized PNG/JPEG files, missing AVIF/WebP, no CDN
4. Element Render Delay < 10% (~0ms) Render-blocking <script> or stylesheet tags delaying paint after image download

High-Impact LCP Fixes

1. Prioritize Hero Image Discovery and Fetch Priority

Never apply loading="lazy" to above-the-fold LCP images. Expose the image directly in server-rendered HTML with fetchpriority="high":

<img
  src="/assets/images/hero-1200.avif"
  srcset="/assets/images/hero-800.avif 800w, /assets/images/hero-1200.avif 1200w"
  sizes="(max-width: 820px) 100vw, 820px"
  width="1200"
  height="675"
  fetchpriority="high"
  decoding="sync"
  alt="System architecture overview">

2. Preload CSS-Driven LCP Backgrounds

If an LCP image is referenced inside an external stylesheet rather than an <img> tag, add a <link rel="preload"> in <head> so the browser’s preload scanner fetches it immediately:

<link rel="preload" as="image" href="/assets/images/banner.avif" type="image/avif" fetchpriority="high">

3. Eliminate Render-Blocking Scripts

Move synchronous <script> tags out of <head> or add defer so HTML parsing and LCP paint are never stalled waiting for script execution.