Core Web Vitals are Google's metrics for measuring real-world user experience. This guide covers practical optimization techniques for each vital metric.
Understanding the Metrics#
Largest Contentful Paint (LCP)#
Measures loading performance. Target: under 2.5 seconds.
Interaction to Next Paint (INP)#
Measures responsiveness. Target: under 200 milliseconds.
Cumulative Layout Shift (CLS)#
Measures visual stability. Target: under 0.1.
Optimizing LCP#
1. Optimize Critical Images#
2. Eliminate Render-Blocking Resources#
3. Optimize Fonts#
4. Server-Side Rendering#
5. CDN and Caching#
Optimizing INP#
1. Break Up Long Tasks#
2. Debounce User Input#
3. Optimize Event Handlers#
4. Use CSS for Animations#
5. Virtualize Long Lists#
Optimizing CLS#
1. Reserve Space for Images#
2. Reserve Space for Ads#
3. Avoid Dynamic Content Insertion#
4. Use CSS Containment#
5. Handle Web Fonts#
Measuring in Production#
Web Vitals Library#
Next.js Built-in Reporting#
Tools for Analysis#
- Chrome DevTools: Performance panel, Lighthouse
- PageSpeed Insights: Lab and field data
- Chrome UX Report: Real user data
- WebPageTest: Detailed waterfall analysis
- Search Console: Core Web Vitals report
Quick Wins Checklist#
- Preload LCP image
- Inline critical CSS
- Use font-display: swap
- Add width/height to images
- Defer non-critical JavaScript
- Enable compression (Brotli/gzip)
- Use CDN for static assets
- Implement caching headers
- Avoid layout-triggering animations
- Reserve space for dynamic content
Conclusion#
Core Web Vitals directly impact user experience and search rankings. Focus on the biggest opportunities first—usually image optimization and render-blocking resources for LCP, long tasks for INP, and missing dimensions for CLS. Measure continuously in production to catch regressions.