LCP, FID/INP, and CLS explained: what they measure, target values, how to diagnose issues, and how to fix common problems.
LCP, FID/INP, and CLS explained: what they measure, target values, how to diagnose issues, and how to fix common problems.
BeforeMerge offers hundreds of code review rules, guides, and detection patterns to help your team ship better code.
Core Web Vitals are Google's metrics for user experience. They directly impact search rankings and user satisfaction.
What it measures: How long until the largest visible element renders.
| Rating | Value |
|---|---|
| Good | <= 2.5s |
| Needs improvement | 2.5s - 4.0s |
| Poor | > 4.0s |
Common causes of poor LCP:
Fixes:
<link rel="preload" as="image" href="hero.webp">next/image with priority for hero imagesWhat it measures: Responsiveness — delay between user interaction and visual update. Replaced FID in March 2024.
| Rating | Value |
|---|---|
| Good | <= 200ms |
| Needs improvement | 200ms - 500ms |
| Poor | > 500ms |
Common causes of poor INP:
Fixes:
setTimeout or requestIdleCallbackuseTransition for non-urgent state updatesReact.memo to prevent unnecessary re-rendersWhat it measures: Visual stability — how much the page layout shifts unexpectedly.
| Rating | Value |
|---|---|
| Good | <= 0.1 |
| Needs improvement | 0.1 - 0.25 |
| Poor | > 0.25 |
Common causes of poor CLS:
Fixes:
width and height on images (or use aspect-ratio)next/image (automatically handles dimensions)font-display: swap with size-adjusted fallback fontsmin-heighttransform animations instead of layout-triggering propertiesimport { onLCP, onINP, onCLS } from "web-vitals";
onLCP(console.log);
onINP(console.log);
onCLS(console.log);next/image for all imagespriority on above-the-fold imagesfont-display: swap on custom fonts