Skip to content

Core Web Vitals: a performance budget for a web application

B2Bnetwork team · · 6 min

System performance

In brief

Core Web Vitals are three measures of a page's user experience, described by Google on web.dev: LCP (loading of the main content, good up to 2.5 s), INP (response to interaction, good up to 200 ms), and CLS (layout stability, good up to 0.1). They are assessed at the 75th percentile of visits, separately for phones and desktops. A performance budget turns these thresholds into rules for the team: limits on the metrics and on the weight of scripts and images, checked automatically with every change.

Three metrics and their thresholds

Core Web Vitals measure three things the user feels directly: when they see the main content, how quickly the page reacts to a click, and whether the layout jumps around. The thresholds according to web.dev:

MetricWhat it measuresGoodNeeds improvementPoor
LCP (Largest Contentful Paint)time until the largest content element is displayed, e.g. a product photo or a headingup to 2.5 s2.5–4 sover 4 s
INP (Interaction to Next Paint)time from an interaction (click, tap, key press) to the next screen updateup to 200 ms200–500 msover 500 ms
CLS (Cumulative Layout Shift)layout shifts the user did not expectup to 0.10.1–0.25over 0.25

In March 2024, INP replaced the earlier FID metric (First Input Delay). FID measured only the delay of the first interaction, while INP takes into account the interactions from the whole visit, so it better exposes problems in applications where users click a lot, such as a cart, a configurator, or an application form.

A page meets the threshold when 75% of visits fall into the "good" category. This is the same way of thinking as with server response times: you assess a percentile, not an average. More on reading percentiles in the article Percentiles instead of averages.

Lab data versus field data

Core Web Vitals are measured in two ways, and you need both:

  • Field data (RUM). Measurement in the browsers of real customers, e.g. with the web-vitals library built into the page or from the Chrome User Experience Report. It shows real devices, networks, and behavior, but reacts to changes with a delay.
  • Lab data. Measurement in controlled conditions, e.g. with the Lighthouse tool, using a fixed device and network throughput. It gives a repeatable result right after a change, but does not reproduce all customers.

The lab cannot measure INP directly, because INP requires real user interactions. Lighthouse uses Total Blocking Time instead, which is the time during which long tasks block the browser's main thread. A good TBT does not guarantee a good INP, but a bad TBT almost always predicts a bad one.

What most often ruins each metric

LCP is ruined by a slow server response to the first request, large images in the wrong format or size, fonts and scripts that block rendering, and a main image that is lazy-loaded or loaded only by JavaScript. In an online store the largest element is usually a product photo or a promotion banner, so these are the ones to prioritize in fetching.

INP is ruined by long tasks on the main thread: large JavaScript bundles executed on every interaction, third-party scripts (analytics, chats, ads), and heavy recalculation of application state after a click. What helps is splitting work into smaller tasks, deferring what is not urgent, and limiting third-party scripts.

CLS is ruined by images and frames without reserved space, banners inserted above the content after the page has loaded, and fonts that change the text width once they finish loading. The simplest fix is to always specify image dimensions and to reserve space for elements loaded later.

A performance budget: how to write it down

A performance budget is a set of agreed limits that the team does not exceed in subsequent changes. It has two layers: limits on user experience metrics and limits on the resources that affect those metrics. An example budget for a product page in a store, explicitly illustrative:

ItemLimitWhere we measure
LCP, 75th percentile, phones≤ 2.5 sfield data
INP, 75th percentile, phones≤ 200 msfield data
CLS, 75th percentile≤ 0.1field data
LCP in the lab, phone profile≤ 2.5 sLighthouse in CI
Total Blocking Time in the lab≤ 200 msLighthouse in CI
JavaScript on the page, compressed≤ 300 KBbundle analysis at build time
Third-party scriptsclosed list, every new one needs approvalchange review

The thresholds for field data come directly from web.dev. The resource limits are a team decision: you set them based on the current state of the page and tighten them once the budget is met with room to spare.

Enforcing the budget in CI and in production

A budget works only if it is checked automatically. A typical setup:

  1. With every change, the CI pipeline builds the application, checks bundle weight, and runs Lighthouse several times on a few key pages. Exceeding a limit stops the change or requires a conscious decision.
  2. Lab results are compared with the previous version, not only with the threshold, to catch the page slowly getting worse.
  3. In production, the web-vitals library sends measurements to the analytics system; a dashboard shows the 75th percentile for phones and desktops, broken down by page type.
  4. Once a sprint, the team reviews the pages that dropped out of the "good" category.

Lab measurements can be unstable, so you run them several times and assess the median. How to reduce false alarms is described in the article Performance tests in CI/CD without false alarms. Core Web Vitals are only part of the picture: a fast page is worth nothing if the server cannot handle the traffic, so before a sales peak you combine them with load tests, as in the case study Preparing an online store for Black Friday.

Questions and answers

Do Core Web Vitals affect ranking in Google?

Google states that Core Web Vitals are one of the page experience signals taken into account in search, alongside many other factors, of which content remains the most important. Good scores will not replace valuable content, but a slow and unstable page loses customers regardless of its position in search results.

Why does Lighthouse show a good score while the field report is poor?

Lighthouse measures a single visit on a fixed device and network. Customers use older phones and slower networks, and click in places the test does not touch. In addition, field data is collected over a longer period, so a fix that the lab shows immediately only appears in field data after some time.

Does FID still count?

Not as a Core Web Vital. In March 2024, INP took its place; it measures the response to all interactions during a visit, not just the delay of the first one. Google's tools and reports have moved to INP, so it is worth writing the performance budget for that metric.

How do I improve INP in an application with a lot of JavaScript?

Start by recording a profile in the browser's developer tools for the slowest interactions and find the long tasks. What usually helps: splitting heavy work into smaller parts, deferring non-urgent calculations until after the screen update, smaller bundles loaded only where they are needed, and limiting third-party scripts.

What it looks like in a project

Your system slows down under load? We'll find where it loses time.

Let's talk

Read more: System performance