Web Performance & Core Web Vitals

Intermediate · 6 min

Why page speed matters and how LCP, INP, and CLS measure the user-visible experience Google now ranks and real users feel.

Before thisServer-Side Rendering & Static Site Generation

Thys du Plooy · 6 min

Web Performance & Core Web Vitals

The player loads from youtube-nocookie.com when you press play. Nothing reaches YouTube before that.

Taught by Thys du PlooyReport a problem with this video
Not started
Set this lesson's status

What you'll learn

  • Core Web Vitals measure three distinct failure modes: slow to show content, slow to respond, and visually unstable.
  • INP replaced FID as Google's official responsiveness metric in March 2024, so FID-era advice is now outdated.
  • Most performance fixes are really about reducing or deferring work the main thread has to do before the page is usable.
  • Images, fonts, and third-party scripts are the most common root causes of a poor LCP and CLS score in practice.
  • Performance is treated as a product requirement because slow pages measurably lose users and search ranking, not just as polish.

Why “fast” needed a definition

For a long time, “is this site fast?” was answered with a stopwatch and a feeling. One engineer measured time-to-first-byte. Another measured when the spinner disappeared. A product manager measured whether it felt sluggish on their own phone. None of these agreed with each other, and none of them agreed with what an actual visitor experienced, because a page can finish loading in the technical sense while still being unusable — the text is there but the font hasn’t swapped in, or the content is visible but jumping around as ads and images stake their claim on the layout.

Core Web Vitals exist to replace that mess of private definitions with three specific, measurable moments that correspond to real user pain: can I see the thing I came for, can I interact with the page without it stalling, and does the layout hold still while I’m trying to read or tap on it. Google also folded these metrics into search ranking, which is the part that gets a lot of attention, but the more useful framing is that they’re a proxy for user frustration that happens to be cheap to measure at scale.

The three metrics, one at a time

LCP (Largest Contentful Paint) times how long it takes for the biggest visible element — usually a hero image, a video poster, or a large block of text — to render on screen. This is deliberately not “time to first paint,” because a page that shows a loading skeleton in 200ms but doesn’t show real content for 8 seconds has not actually helped anyone. LCP targets the content the user is there to see.

INP (Interaction to Next Paint) measures responsiveness. Every time a user clicks, taps, or types, the browser has to run some JavaScript and then repaint the screen to reflect the result. INP looks at the slowest of those interactions across the entire page visit and reports how long the user waited between their action and the visual response. A page that loads fast but then freezes for half a second every time you click a button has a responsiveness problem, not a loading problem, and INP is the metric that catches it.

CLS (Cumulative Layout Shift) quantifies how much stuff moves around unexpectedly. If you’ve ever gone to tap a button and had an ad load in above it at the last second, shifting the button down just as your finger landed on what is now a different element, you’ve experienced what CLS measures. It’s a unitless score built from how much of the viewport shifted and how far, summed across the whole visit.

INP replaced FID — don’t trust older material that doesn’t say so

Until March 2024, the third Core Web Vital was FID (First Input Delay), and a lot of performance content written before then still talks about it as current. FID only measured the delay before the very first interaction on a page — click a button once, and FID stopped caring about anything after that. It also only measured the delay before the browser started processing the event, not how long the whole response took to actually reach the screen.

INP fixes both gaps. It samples interactions across the entire page lifetime, not just the first one, and it measures the full round trip through to the next paint, not just the start of processing. The practical effect is that INP punishes a much more common real-world problem: a page that’s snappy on the first click but becomes sluggish after a few seconds of JavaScript accumulating event listeners, running timers, or holding the main thread with expensive renders. If you read material from 2021–2023 that still centers FID — including the deeper-dive linked with this lesson — treat its framing of “the third vital” as outdated and substitute INP; the underlying performance advice about reducing JavaScript work still mostly holds, but the metric it’s measured against has changed.

Where the time actually goes, and what to do about it

Nearly every performance fix is some version of “do less work, or do it later.” A render-blocking stylesheet or synchronous script in the <head> forces the browser to pause before it can paint anything — moving non-critical CSS and scripts to load asynchronously, or deferring them until after first paint, directly improves LCP. Unoptimized images are the single most common LCP killer in practice: shipping a 4000px photo to a 400px <img> wastes bandwidth and decode time on pixels nobody sees, so resizing, compressing, and serving modern formats like webp or avif usually produces the single biggest win available.

Code splitting addresses the INP side of the equation. Bundling your entire application into one JavaScript file means the browser has to parse and execute code for parts of the page the user hasn’t even scrolled to yet, all before it can respond to a click. Splitting bundles by route or by component, and lazy-loading anything below the fold, keeps the main thread free to respond quickly to the interactions that are actually happening right now.

CLS is usually a sizing problem. Always give images and embeds explicit width and height attributes (or an aspect-ratio in CSS) so the browser reserves their space before the asset downloads. Reserve space for ads and dynamically injected banners the same way, and load custom fonts with font-display: optional or a matched fallback font so text doesn’t visibly reflow when the real typeface swaps in.

None of these techniques are exotic. The discipline is in measuring which of the three vitals is actually failing for your real users — via field data from something like Chrome’s User Experience Report, not just a single lab run in DevTools — before spending effort optimizing a metric that was already fine.

Check yourself

  1. 01What are the three Core Web Vitals and what does each one actually measure?

    LCP measures how long the largest visible element takes to render, INP measures how long the page takes to respond to user interactions throughout its lifetime, and CLS measures how much visible content shifts around unexpectedly.

  2. 02Why shouldn't you trust an article that frames FID as the current responsiveness metric?

    FID was retired and replaced by INP as an official Core Web Vital in March 2024 because FID only measured the delay before the first interaction, while INP measures responsiveness across every interaction on the page.

  3. 03What are two concrete techniques that improve LCP, and why do they help?

    Lazy-loading offscreen images stops the browser from spending bandwidth and main-thread time on content the user cannot see yet, and preloading the hero image or font tells the browser to fetch the thing that actually determines LCP before it would otherwise discover it.

  4. 04Why does reserving space for an image or ad slot improve CLS even before the asset loads?

    CLS penalizes layout that moves after it has already been painted, so giving an element its final width and height up front means the browser never has to shove surrounding content out of the way once the real asset arrives.

Go deeper

Notes

Private to you

Esc
↑↓ navigate↵ open? shortcuts

Keyboard shortcuts

Press Esc to close

Anywhere

⌘K
Search and commands
/
Search
?
This sheet
Esc
Close

Reading a lesson

J
Next lesson
K
Previous lesson
B
Bookmark