Core Web Vitals: How to Measure and Improve Them
Your users expect fast, responsive pages. Google's Core Web Vitals (CWV) quantify that experience: Largest Contentful Paint (LCP) measures loading, Interaction to Next Paint (INP) measures interactivity, and Cumulative Layout Shift (CLS) measures visual stability. Poor scores hurt user satisfaction and can affect search rankings. This guide shows you how to measure CWV accurately and fix common issues with practical steps.
What Are Core Web Vitals?
Core Web Vitals are three metrics that reflect real-world user experience:
- LCP: Time until the largest content element (image, text block) is rendered. Good: ≤2.5s.
- INP: Time from user interaction to the next paint. Good: ≤200ms.
- CLS: Sum of layout shift scores. Good: ≤0.1.
These thresholds are assessed at the 75th percentile of page loads, meaning 75% of visits should meet the target.
How to Measure Core Web Vitals
You need both lab and field data. Lab tools simulate conditions; field data comes from real users.
Lab Tools
- Lighthouse in Chrome DevTools: Run audits for performance, accessibility, and SEO. It provides lab CWV scores and opportunities to improve.
- WebPageTest: Advanced testing with custom network conditions and device emulation.
Field Tools
- Chrome UX Report (CrUX): Public dataset of real-user metrics. Access via PageSpeed Insights or BigQuery.
- web-vitals JavaScript library: Collect CWV from actual users and send to your analytics.
Use field data to identify real problems, then lab tools to debug and verify fixes.
Improving Largest Contentful Paint (LCP)
LCP is often the hero image or main heading. Optimize these elements:
- Optimize images: Compress images, use modern formats like WebP or AVIF, and serve responsive sizes with
srcset. - Preload critical resources: Add
<link rel="preload">for the LCP image or font. - Reduce server response time: Use caching, CDNs, and efficient backend code.
- Eliminate render-blocking resources: Defer non-critical CSS/JS, inline critical CSS.
Example: preload your LCP image:
<link rel="preload" as="image" href="/hero.webp" fetchpriority="high">
Also set fetchpriority="high" on the <img> tag to hint importance.
Improving Interaction to Next Paint (INP)
INP measures responsiveness to clicks, taps, and keyboard input. Long tasks block the main thread. To improve INP:
- Break up long tasks: Use
setTimeoutorrequestIdleCallbackto yield to the browser. - Optimize event handlers: Debounce or throttle expensive operations.
- Reduce JavaScript: Code-split, tree-shake, and defer non-critical scripts.
- Use web workers for CPU-intensive work.
Example: yield to the main thread:
async function yieldToMain() {
return new Promise(resolve => setTimeout(resolve, 0));
}
async function handleClick() {
// Do some work
await yieldToMain();
// Continue
}
Improving Cumulative Layout Shift (CLS)
CLS happens when elements move unexpectedly. Common causes: images without dimensions, ads, embeds, and web fonts.
- Set width and height on images and videos, or use CSS
aspect-ratio. - Reserve space for dynamic content (ads, embeds) with min-height.
- Use
font-display: swapand preload fonts to avoid invisible text causing shifts. - Avoid inserting content above existing content unless triggered by user interaction.
Example: reserve space for an ad:
.ad-slot {
min-height: 250px;
background: #f0f0f0;
}
Comparison of Metrics and Tools
| Metric | What it Measures | Good Threshold | Primary Tools |
|---|---|---|---|
| LCP | Loading performance | ≤2.5s | Lighthouse, CrUX, web-vitals |
| INP | Interactivity | ≤200ms | Lighthouse, web-vitals |
| CLS | Visual stability | ≤0.1 | Lighthouse, CrUX, web-vitals |
Practical Workflow to Improve CWV
- Measure field data with PageSpeed Insights or CrUX to identify pages with poor scores.
- Run Lighthouse on those pages to get specific opportunities.
- Prioritize fixes by impact: often LCP and CLS are easiest to improve.
- Implement changes and test in lab.
- Deploy and monitor field data to confirm improvement.
- Iterate on remaining issues.
Remember that CWV are user-centric; always validate with real-user data.
FAQ
What are Core Web Vitals and why do they matter?
Core Web Vitals are three metrics (LCP, INP, CLS) that quantify loading, interactivity, and visual stability. They matter because they reflect real user experience and are used by Google as a ranking signal.
How often should I measure Core Web Vitals?
Monitor field data continuously and run lab tests after major changes. A monthly review of CrUX data is a good practice.
Can I improve Core Web Vitals without rebuilding my site?
Yes. Many improvements like image optimization, preloading, and layout fixes can be applied incrementally without a full rebuild.
Need to compress images for faster LCP? Try our free Image Compressor to reduce file sizes without losing quality.