Core Web Vitals: How to Measure and Improve Them
Your pages load, but users still bounce. Or a search console report flags "poor" Core Web Vitals on mobile, and you are not sure whether the problem is real or just a lab artifact. Core Web Vitals turn vague "performance" talk into three measurable signals — and every one of them has a concrete cause you can find and fix.
This guide explains what each metric measures, how to collect trustworthy data, and which fixes actually move the needle. No invented benchmarks — just the mechanics and the workflow.
What Core Web Vitals actually measure
Core Web Vitals are three user-centric metrics defined by the web performance community and reflected in Google's page experience signals. Each maps to a different kind of frustration:
- LCP (Largest Contentful Paint) — how long until the main content (usually a hero image or heading) is visible. It answers: when does the page feel loaded?
- INP (Interaction to Next Paint) — the latency of user interactions across the page visit. It answers: does the page respond when I tap or type?
- CLS (Cumulative Layout Shift) — how much visible content jumps around unexpectedly. It answers: can I trust what I am about to tap?
These replaced older proxies like First Input Delay and are evaluated at the 75th percentile of real page loads. That detail matters: a fast laptop proves nothing if most of your traffic is mid-range mobile.
Field data vs lab data: measure both
The most common measurement mistake is trusting a single Lighthouse run. Lab tools simulate a load under fixed conditions; field data comes from real users on real devices and networks. You need both, for different jobs.
| Source | Type | Best used for |
|---|---|---|
| Chrome UX Report / Search Console | Field | Knowing whether real users experience problems |
| PageSpeed Insights | Both | Quick field snapshot plus lab diagnostics |
| Lighthouse / DevTools | Lab | Reproducing and debugging specific issues |
| web-vitals JS library | Field (your own) | Segmenting by page, device, and country |
Start with field data to confirm a problem exists, then use lab tools to reproduce it. If field data says LCP is fine but Lighthouse screams, you are probably optimizing a scenario your users do not have.
Step-by-step: build a measurement loop
- Baseline. Pull field data for your key templates (home, product, article) on mobile and desktop. Note the 75th percentile values.
- Instrument. Add the
web-vitalslibrary and send LCP, INP, and CLS to your analytics endpoint, tagged with route and device type. - Reproduce. In DevTools, throttle to a mid-tier mobile profile with fast 4G and record a performance trace of a slow template.
- Fix one cause. Change a single thing (e.g., preload the hero image) and re-measure under the same conditions.
- Verify in the field. Field data lags behind deploys, so compare week-over-week rather than hour-over-hour.
A minimal instrumentation snippet looks like this:
import { onLCP, onINP, onCLS } from 'web-vitals';
function report(metric) {
const body = JSON.stringify({
name: metric.name,
value: metric.value,
rating: metric.rating,
path: location.pathname,
});
navigator.sendBeacon('/vitals', body);
}
onLCP(report);
onINP(report);
onCLS(report);
Keep the payload small and sample if traffic is high. The goal is trend visibility, not exhaustive logging.
Fixing LCP: get the main content early
LCP is usually blocked by one of four things: slow server response (TTFB), render-blocking resources, a late-discovered hero image, or client-side rendering that paints nothing until JavaScript runs.
- Improve TTFB. Cache HTML at the edge, use HTTP caching headers correctly, and check that your database queries are not on the critical path.
- Preload the hero image. Add
<link rel="preload" as="image" href="#">and avoid lazy-loading above-the-fold images. - Serve modern formats and sizes. Use responsive
srcset/sizesand AVIF or WebP with sensible fallbacks. - Cut render-blocking CSS/JS. Inline critical CSS, defer non-critical scripts, and remove unused bundles.
- Avoid client-only rendering for the LCP element. Server-render or statically generate the hero content.
If your LCP element is a text block, font loading matters: use font-display: swap and preload the primary font so text is not invisible during load.
Fixing INP: keep the main thread free
INP measures the delay between a user interaction and the next painted frame. Long JavaScript tasks on the main thread are the usual culprit, followed by heavy event handlers and expensive layout work.
- Break up long tasks. Use
setTimeout,requestIdleCallback, or the scheduler API to yield to the browser between work chunks. - Defer third-party scripts. Analytics, chat widgets, and A/B tools often run synchronously; load them after interaction or on idle.
- Debounce input handlers. Filtering a list on every keystroke is a classic INP killer — debounce or move filtering to a worker.
- Reduce DOM size. Huge trees make style recalculation and layout slower on every interaction.
- Use CSS transforms and opacity for animations instead of properties that trigger layout.
In a performance trace, look for long yellow "scripting" blocks overlapping user input. That is your INP budget being spent.
Fixing CLS: reserve space and stop the jumps
Layout shift happens when elements are inserted or resized without reserved space. The fixes are mostly about being explicit:
- Set
widthandheightattributes (oraspect-ratio) on images and videos so the browser reserves the box. - Reserve space for ads, embeds, and cookie banners before they load.
- Avoid injecting content above existing content — append below instead.
- Use
font-display: optionalor preloaded fonts to avoid late font swaps that reflow text. - Animate with
transform, nottop/left/height.
CLS is often the cheapest metric to fix because it is a markup discipline problem, not an infrastructure one.
Don't forget the delivery layer
Frontend fixes only go so far if your server is slow or your assets are uncached. Check compression (Brotli or gzip), long-lived cache headers with content hashes, HTTP/2 or HTTP/3, and a CDN for static assets. Server logs are a useful sanity check: if you see slow upstream response times on HTML routes, no amount of image optimization will fix LCP.
You can inspect access logs to spot slow routes and heavy traffic patterns using the Nginx log analyzer, which helps correlate backend latency with the pages users actually load.
Prioritize by template, not by score
A single site-wide score hides reality. Group pages by template (home, listing, detail, checkout) and fix the templates with the most traffic and the worst field data first. A perfect Lighthouse score on a low-traffic page is worth little; a modest LCP improvement on your top landing page affects every visitor.
Also resist the urge to chase a round number. Core Web Vitals are thresholds, not a competition — moving from "poor" to "needs improvement" on your busiest template is a real win.
FAQ
What are the three Core Web Vitals?
LCP (Largest Contentful Paint) measures loading of the main content, INP (Interaction to Next Paint) measures responsiveness to user input, and CLS (Cumulative Layout Shift) measures visual stability.
Should I trust Lighthouse or field data?
Use field data to decide whether a real problem exists, and lab tools like Lighthouse to reproduce and debug it. A single lab run is a snapshot, not a verdict.
Why does my Lighthouse score differ from PageSpeed Insights?
PageSpeed Insights shows both lab and field data, and lab conditions (device, throttling, network) differ between runs. Compare like-for-like conditions and focus on field trends.
Ready to check your own pages? Run your key templates through a measurement loop today, fix the single biggest cause on your busiest template, and verify the change with field data before moving on.