Master LCP, INP, CLS, and TTFB — what they measure, what causes them to be poor, and exactly how to fix each one. Understand why Google uses Core Web Vitals as ranking signals and how to design for performance from the architecture level down.
Core Web Vitals measure three aspects of user experience: loading (LCP — how quickly the main content appears), interactivity (INP — how quickly the page responds to input), and visual stability (CLS — how much the layout unexpectedly shifts). Google uses them as ranking signals because they correlate with whether users stay or leave. Improving them is not just a performance exercise — it's a business metric.
Measures the time from navigation to when the largest visible element renders in the viewport. Usually a hero image, banner, or above-the-fold heading. Good: < 2.5s. Needs improvement: 2.5–4s. Poor: > 4s.
rel="preload", set proper dimensions, never lazy-load it<!-- Optimal LCP image setup -->
<link rel="preload" as="image" href="/hero.avif" />
<img
src="/hero.avif"
fetchpriority="high"
width="1200" height="600"
alt="Hero"
<!-- NO loading="lazy" — lazy loading kills LCP -->
/>
Replaced FID in 2024. Measures the time from user input (click, tap, key press) to when the browser paints the next frame in response. Good: < 200ms. Poor: > 500ms.
scheduler.yield() or setTimeout, use Web Workers for CPU-heavy work// Yield to the browser between expensive operations
async function processLargeDataset(items) {
for (let i = 0; i < items.length; i++) {
process(items[i]);
if (i % 100 === 0) {
await scheduler.yield(); // let browser handle pending interactions
}
}
}
Measures unexpected visual movement of page elements during loading. An image that loads and pushes text down is a CLS violation. Good: < 0.1. Poor: > 0.25.
font-display: swap and preload the font<!-- Reserve space — no layout shift when image loads -->
<img src="/photo.webp" width="800" height="600" alt="..." />
/* CSS — aspect-ratio maintains space */
.image-container {
aspect-ratio: 4 / 3;
width: 100%;
}
Time from navigation start to the first byte of the HTML response. Affected by server processing time, redirects, and network latency. A slow TTFB affects all other metrics because nothing can render before HTML arrives.
Fix: CDN edge caching (serves HTML from a server near the user), SSG/ISR (serve pre-built HTML instantly), optimize server-side queries.
// web-vitals library — report in real user monitoring (RUM)
import { onLCP, onINP, onCLS } from 'web-vitals';
onLCP(({ value, rating }) => analytics.track('LCP', { value, rating }));
onINP(({ value, rating }) => analytics.track('INP', { value, rating }));
onCLS(({ value, rating }) => analytics.track('CLS', { value, rating }));Lighthouse score = Core Web Vitals — Lighthouse is a lab tool (simulated, controlled). Core Web Vitals measured by Google are from real users (field data). A 100 Lighthouse score doesn't guarantee good field CWV.
CLS is only caused by images — any element that shifts: ads loading, cookie banners, dynamic content injected above existing content, web fonts swapping — all cause CLS.
INP replaced FID and measures the same thing — FID measured only the first interaction and only the input delay. INP measures all interactions throughout the page lifetime and includes processing time and render time.
Improving one metric automatically improves others — optimizations can conflict: SSR improves LCP but adds server processing time (TTFB). Heavy JavaScript frameworks hurt INP. Trade-offs must be measured.
Next.js Image component: sets width/height automatically (fixes CLS), serves WebP/AVIF (improves LCP), lazy-loads off-screen images (improves initial page weight)
News sites after CWV rollout: BBC, Guardian significantly improved LCP by moving from CSR to SSR/SSG and preloading hero images — correlated with ranking improvements
E-commerce: product image CLS is a common issue — fixed by CSS aspect-ratio on image containers; Pinterest improved CLS by 50% this way
web-vitals library used in production by large sites to collect real user metrics and alert on regressions before they affect rankings
What are the three Core Web Vitals and what does each measure?
What are the most common causes of poor LCP and how do you fix them?
What causes CLS (Cumulative Layout Shift) and how do you fix it?
What is INP (Interaction to Next Paint) and how does it differ from FID?
How do you measure Core Web Vitals in a production React app?
What techniques reduce INP on a React app with expensive renders?
Reading answers is not the same as knowing them. Practice saying them out loud with AI feedback — that's what builds real interview confidence.