Largest Contentful Paint (LCP)
Last updated: April 2026
LCP measures how long it takes for the largest visible element in the viewport to render. It is one of Google's Core Web Vitals and a direct search ranking signal. Target: under 2.5 seconds.
What counts as the LCP element
The browser tracks the largest element visible in the viewport: images, video poster images, background images loaded via CSS, and large blocks of text. Usually the hero image or main heading.
Fix 1 โ preload the LCP image
<link rel="preload" as="image" href="/hero.webp" fetchpriority="high" type="image/webp">
Fix 2 โ add fetchpriority to the image tag
<img src="/hero.webp" fetchpriority="high" width="1200" height="600" alt="Hero image">
Fix 3 โ serve images from a CDN with long cache
# Nginx: cache images at CDN edge
location ~* \.(jpg|webp|png|avif)$ {
expires 30d;
add_header Cache-Control "public, max-age=2592000" always;
}
Fix 4 โ use Cloudflare Early Hints
# Cloudflare automatically sends Early Hints for preloaded resources # Enable: Cloudflare Dashboard -> Speed -> Optimization -> Early Hints
Fix 5 โ reduce server response time (TTFB)
LCP cannot start until the browser receives the HTML. Reduce TTFB with caching, CDN, and faster server-side rendering.