All Guides
LCP 8 min read· Updated Apr 2026

How to Fix LCP (Largest Contentful Paint) — Complete Guide

Learn exactly how to fix LCP issues and bring your Largest Contentful Paint under 2.5 seconds. Includes code snippets for image optimization, preloading, and server-side fixes.

What is LCP and Why Does It Matter?

Largest Contentful Paint (LCP) measures how long it takes for the largest visible element on the page (usually a hero image, heading, or video poster) to render. Google considers LCP good if it loads within 2.5 seconds. Poor LCP (>4.0s) directly hurts your search ranking.


LCP is one of the three Core Web Vitals that Google uses as a ranking signal. It's also the metric most correlated with user-perceived load speed — users judge a page by when the "main content" appears.

Common Causes of Slow LCP

1.Unoptimized hero images — serving 4000×3000px PNGs instead of compressed WebP
2.Render-blocking CSS/JS — stylesheets and scripts that delay rendering
3.Slow server response (TTFB) — the server takes too long to respond
4.Client-side rendering — the LCP element is rendered by JavaScript, not HTML
5.No image preloading — the browser discovers the hero image too late
6.Third-party scripts — analytics, chat widgets, and ads blocking the main thread

Fix 1: Preload the LCP Image

Add a preload link in your so the browser starts downloading the LCP image immediately, before CSS is parsed:



html
<link rel="preload" as="image" href="/hero.webp" fetchpriority="high" />


For Next.js, use the priority prop on next/image:



jsx
import Image from 'next/image'

<Image src="/hero.webp" alt="Hero" priority />


This alone often cuts LCP by 1-2 seconds.

Fix 2: Serve Modern Image Formats

Convert hero images to WebP or AVIF. WebP is 25-35% smaller than JPEG at the same quality. Use the element for fallback:



html
<picture>
  <source srcset="/hero.avif" type="image/avif" />
  <source srcset="/hero.webp" type="image/webp" />
  <img src="/hero.jpg" alt="Hero" width="1200" height="630" />
</picture>


Always specify width and height to prevent layout shift (CLS).

Fix 3: Eliminate Render-Blocking Resources

Move non-critical CSS below the fold using media="print" hack or async loading:



html
<!-- Critical CSS inline -->
<style>/* only above-the-fold styles */</style>

<!-- Non-critical CSS loaded async -->
<link rel="stylesheet" href="/non-critical.css" media="print" onload="this.media='all'" />


For JavaScript, use defer or async attributes, and move heavy scripts below the fold.

Fix 4: Improve Server Response Time

Target TTFB under 200ms:


- Use a CDN (Vercel, Cloudflare, Fastly) to serve from edge locations

- Enable compression (gzip/brotli) on your server

- Use stale-while-revalidate caching headers

- Optimize database queries — add indexes, reduce N+1 queries

- Use Incremental Static Regeneration (ISR) in Next.js for dynamic pages

Measuring LCP

Use these tools to measure and track LCP:


1.VitalFix Dashboard — run a free audit at vitalfix.dev/dashboard
2.Chrome DevTools — → Performance tab → look for "LCP" marker
3.PageSpeed Insights — pagespeed.web.dev
4.web-vitals library — `onLCP(console.log)` in your JavaScript
5.Chrome UX Report — real user data from Search Console

Test these fixes on your site

Run a free audit to see your current LCP score and get prioritized fix recommendations.

Run Free Audit

Related Guides

CLS7 min

How to Fix CLS (Cumulative Layout Shift) — Stop Layout Jank

TTFB6 min

How to Reduce TTFB (Time to First Byte) — Server Speed Guide

General5 min

Lazy Loading Images — The Complete Implementation Guide