Pages rarely become slow in one release. They get slower a few kilobytes and a few milliseconds at a time: a new library, a bigger hero image, another third-party tag. A performance budget sets limits that every change must respect, and makes the cost of new features visible before they ship.
Two kinds of budgets
| Kind | Examples | Checked with |
|---|---|---|
| Quantity budgets | JavaScript under 170 KB compressed, images under 500 KB on the home page, 5 third-party origins at most | Build tools, CI |
| Timing budgets | LCP under 2.5 s, INP under 200 ms, CLS under 0.1 at p75 on mobile | Lab tests in CI, real-user data |
Quantity budgets are easy to enforce on every pull request. Timing budgets are what users feel. Use both.
Setting the numbers
- Measure current values per key template (home, listing, product, article, checkout) from real users, split by mobile and desktop.
- Set timing budgets at Google's "good" thresholds (LCP 2.5 s, INP 200 ms, CLS 0.1) at p75, or at your current values if you are already better.
- Set quantity budgets slightly below what you ship today on the heaviest pages, so the next addition forces a conversation.
Enforcing in CI
[
{
"path": "/*",
"resourceSizes": [
{ "resourceType": "script", "budget": 170 },
{ "resourceType": "image", "budget": 500 },
{ "resourceType": "third-party", "budget": 100 }
],
"timings": [
{ "metric": "largest-contentful-paint", "budget": 2500 },
{ "metric": "total-blocking-time", "budget": 200 }
]
}
]
Lighthouse CI can read a budget file like this and fail the build when a page goes over. Bundle-size tools can also fail a pull request that grows a bundle beyond its limit.
Watching in production
Lab tests run on one device and network. Real-user data shows what visitors experience. Track p75 LCP, INP and CLS per template and device daily, and alert when a template crosses its budget for a sustained period (for example a full day), with a release marker to show what changed.
When a change needs to exceed the budget
Budgets are for conversations, not vetoes. If a feature needs more, find savings elsewhere (remove an unused library, lazy-load a widget, compress images) or agree explicitly to raise the budget with a reason.
Worked example
A retailer set budgets of 200 KB of JavaScript and LCP 2.5 s on product pages. A new reviews widget added 120 KB and pushed LCP to 3.1 s in CI. The team loaded the widget only when it scrolled into view, removed an unused carousel library (45 KB) and preloaded the hero image. The page shipped at 185 KB and LCP 2.2 s, and real-user p75 LCP on mobile improved by 300 ms the following week.
Common mistakes
- Budgets only in lab tests, never compared with real users.
- One budget for every page, ignoring that checkout and articles differ.
- Budgets nobody enforces, which quietly become wishes.
- Ignoring third parties, often the biggest share of JavaScript; see third-party scripts and performance.
Tools
VitalRix real user monitoring reports Core Web Vitals per page and device from real visitors, and the free LCP and INP checks test a page in a real Chrome browser. For reducing JavaScript, read reduce JavaScript bundle size.
Budgets per template
| Template | LCP (p75, mobile) | INP (p75) | JS (compressed) | Images (first screen) |
|---|---|---|---|---|
| Home | 2.0 s | 200 ms | 150 KB | 300 KB |
| Product | 2.5 s | 200 ms | 180 KB | 400 KB |
| Article | 2.0 s | 150 ms | 120 KB | 250 KB |
| Checkout | 2.5 s | 150 ms | 200 KB | 100 KB |
Tight budgets on pages that bring visitors in from search (home, articles) and on checkout, where every second costs conversions, and slightly looser ones elsewhere.
Getting buy-in
Show the business what the budget protects: conversion or bounce rate by LCP bucket from your own analytics, and the Core Web Vitals report in Search Console. A budget framed as "protecting revenue and search traffic" survives roadmap discussions better than one framed as engineering preference. Read improve LCP and fix CLS for the fixes you will need when a page goes over.
What should my JavaScript budget be?
It depends on your audience. Many teams aim for well under 200 KB compressed on mobile-critical pages and adjust from real-user INP data.
Should performance budgets block deploys?
Quantity budgets can fail pull requests. Timing budgets from real users are better as alerts and review triggers.
Do budgets apply to single-page apps?
Yes. Budget the initial bundle, route chunks and interaction responsiveness (INP).
Try VitalRix free
Uptime monitoring, APM, logs, real user monitoring and status pages in one place. No credit card needed.