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
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:
For Next.js, use the priority prop on next/image:
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:
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:
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:
Test these fixes on your site
Run a free audit to see your current LCP score and get prioritized fix recommendations.
Run Free Audit