In short
A performance budget is a list of numeric limits the site commits not to exceed: display time, JavaScript weight, number of third-party requests, per page type. It is written down, known to the team, checked automatically, and comes with a simple rule for overruns: optimize, remove something else, or give up. Once it is in place, performance stops being recovered in fits and starts after each degradation: it is defended with every change.
Why it matters
A site does not become slow all at once. It becomes slow through successive additions, each justified on its own: a customer review tool, an extra font, a campaign pixel, a carousel on the home page, a library for an animation. Nobody decides to degrade the site; but nobody has the means to say no either, for lack of a shared benchmark.
The budget provides that benchmark. It turns a discussion of opinions (“it's fine, it's still fast”) into a finding (“this addition pushes the product page's JavaScript over the limit”). It makes the cost visible before going live, at the moment when refusing or slimming down costs almost nothing.
It also serves as a contract with agencies and marketing teams: every request for an addition is measured against the same grid.
What it improves
- Stability of Core Web Vitals Regressions are stopped before they reach visitors. It is a preventive effect, indirect by nature.
- Faster trade-offs The overrun rule avoids reopening the debate with every request.
- Control of third-party scripts Every new tag has a visible cost.
- Costs Fewer catch-up projects, less bandwidth.
- Rankings No direct effect. The budget protects the results achieved by the other checks in this topic.
How to check
The budget exists if you can answer yes to these five questions:
- Is there a written document listing the limits, per page template?
- Are these limits based on measurements taken on your site, under set test conditions?
- Are they checked automatically, at each deployment or at regular intervals?
- Is a named person responsible for them?
- Do you know what happened the last time a limit was exceeded?
A budget that has never blocked or changed anything is not being applied.
How to implement
Step 1 — Measure the current state
List your templates (home, list or category, product or service page, article, landing page) and choose a representative URL for each. Measure under fixed conditions: see test on a slow mobile connection (opens in a new tab).
Lighthouse provides metrics and weight per resource type:
npx lighthouse https://example.com/ --only-categories=performance --output=json --output-path=./accueil.json
node -e "
const report = require('./accueil.json');
const audits = report.audits;
console.log('LCP:', audits['largest-contentful-paint'].displayValue);
console.log('TBT:', audits['total-blocking-time'].displayValue);
console.log('CLS:', audits['cumulative-layout-shift'].displayValue);
console.table(audits['resource-summary'].details.items.map((item) => ({
type: item.resourceType,
requetes: item.requestCount,
ko: Math.round(item.transferSize / 1024),
})));
"
Repeat three to five times per URL and keep the median. At the same time, note the field Core Web Vitals in Search Console or in the Chrome User Experience Report. See analyze real-user CrUX data (opens in a new tab).
Step 2 — Choose the indicators and thresholds
Keep few indicators, split into three families:
| Family | Indicators | Value |
|---|---|---|
| Experience (field) | LCP, INP, CLS at the 75th percentile | what visitors experience; what Google measures |
| Experience (lab) | LCP, Total Blocking Time, CLS under your test conditions | can be checked before going live |
| Quantities | JavaScript weight, total weight, number of requests, number of third-party requests, number of font files | easy to understand, easy to link to a decision |
For field metrics, the thresholds are those Google publishes for an experience rated as good: LCP less than or equal to 2.5 s, INP less than or equal to 200 ms, CLS less than or equal to 0.1.
For quantities, there is no universal value: an editorial site and an online store do not have the same needs. Two reliable methods:
- Start from the current state. The first limit is today's measured value: the site must not get any worse. Then set a lower target, to be reached in stages.
- Benchmark. Measure the same templates on three to five competitors, under the same conditions, and aim to do better than the best of them.
Template table. The values below are a fictitious example, to be replaced with your own:
| Indicator (mobile, reference conditions) | Home | Category | Product page | Article |
|---|---|---|---|---|
| Lab LCP | 2.5 s | 2.5 s | 2.5 s | 2.0 s |
| Total Blocking Time | 300 ms | 300 ms | 300 ms | 200 ms |
| CLS | 0.1 | 0.1 | 0.1 | 0.1 |
| JavaScript transferred | 300 KB | 300 KB | 350 KB | 200 KB |
| Total weight transferred | 1,500 KB | 1,500 KB | 1,800 KB | 1,000 KB |
| Third-party requests | 10 | 10 | 12 | 8 |
| Font files | 3 | 3 | 3 | 3 |
Add a line for the state after cookies are accepted, which loads more scripts. See test before and after cookie consent (opens in a new tab).
Step 3 — Set the ground rules
A budget without an overrun rule is just a table. Write down, on one page:
- The owner: a named person who makes the call.
- The rule: when an addition pushes a limit over, there are three possible outcomes, in this order. Optimize the addition to fit within the limit. Otherwise, remove or slim down something else to compensate. Otherwise, give up the addition.
- Exceptions: granted by the owner, in writing, with an end date (a sales promotion, for example).
- The process for marketing tags: every new tag goes through the same measurement before being published in the tag manager. See limit third-party scripts (opens in a new tab).
- The review: every quarter, limits that have been reached are tightened, and a limit is only raised by explicit decision.
Step 4 — Automate with Lighthouse CI
Lighthouse CI is free and runs in any integration pipeline. Install it (npm install --save-dev @lhci/cli) and create lighthouserc.json at the root of the project:
{
"ci": {
"collect": {
"url": [
"https://staging.example.com/",
"https://staging.example.com/categorie/exemple",
"https://staging.example.com/produit/exemple"
],
"numberOfRuns": 3
},
"assert": {
"assertions": {
"largest-contentful-paint": ["error", { "maxNumericValue": 2500 }],
"cumulative-layout-shift": ["error", { "maxNumericValue": 0.1 }],
"total-blocking-time": ["warn", { "maxNumericValue": 300 }],
"resource-summary:script:size": ["error", { "maxNumericValue": 300000 }],
"resource-summary:total:size": ["warn", { "maxNumericValue": 1500000 }],
"resource-summary:third-party:count": ["warn", { "maxNumericValue": 10 }]
}
},
"upload": {
"target": "filesystem",
"outputDir": "./lhci-reports"
}
}
}
Durations are in milliseconds and weights in bytes. The error level makes the command fail, warn displays it without blocking. For different limits depending on the template, replace assertions with an assertMatrix list in which each entry targets a URL pattern (matchingUrlPattern).
npx lhci autorun
Example GitHub Actions job, triggered on every pull request:
name: Performance budget
on: [pull_request]
jobs:
lighthouse:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
- run: npm ci
- run: npx lhci autorun
For a site built as static files, replace url with "staticDistDir": "./dist": Lighthouse CI serves the folder itself. See integrate SEO, performance and accessibility tests into CI/CD (opens in a new tab).
Good to know: lab results vary from one run to the next, especially on shared integration machines. Keep a margin between your usual values and the blocking threshold, and set the most unstable metrics to
warn.
With a build-time check
Weight limits can be checked without a browser, directly on the output files. With the size-limit tool (npm install --save-dev size-limit @size-limit/file), in package.json:
{
"scripts": {
"size": "size-limit"
},
"size-limit": [
{ "path": "dist/assets/*.js", "limit": "300 kB" },
{ "path": "dist/assets/*.css", "limit": "60 kB" }
]
}
npm run size fails if a limit is exceeded. With webpack, the built-in equivalent is configured in webpack.config.js:
module.exports = {
performance: {
hints: 'error',
maxAssetSize: 250000,
maxEntrypointSize: 400000,
},
};
When a limit is breached, a bundle analyzer (webpack-bundle-analyzer, rollup-plugin-visualizer for Vite, @next/bundle-analyzer for Next.js) shows which dependency has grown.
Without an integration pipeline
On a WordPress, Shopify or PrestaShop site, or any site without automated deployment, the check is periodic. The PageSpeed Insights API, which is free, gives the same measurements as the online tool (an API key is recommended for regular use):
curl -s "https://www.googleapis.com/pagespeedonline/v5/runPagespeed?url=https%3A%2F%2Fexample.com%2F&strategy=mobile&category=performance" -o psi.json
node -e "
const audits = require('./psi.json').lighthouseResult.audits;
['largest-contentful-paint', 'total-blocking-time', 'cumulative-layout-shift', 'total-byte-weight']
.forEach((id) => console.log(id, ':', audits[id].displayValue));
"
Practical rules:
- Every month, record each template's indicators in the budget table. See monitor performance (opens in a new tab).
- Before activating a plugin, an app or a tag, measure the page concerned before and after in a test environment. The difference is the cost of the addition.
- After every theme update, take the measurements again.
Paid services (SpeedCurve, Calibre, DebugBear) automate these measurements and send alerts when a limit is exceeded.
Step 5 — Tie the budget to the field
Lab limits are a means; the goal remains the real experience. Every quarter, compare:
- the field Core Web Vitals per group of pages (Search Console, Core Web Vitals report);
- compliance with the budget over the same period.
If the budget is met but the field data deteriorates, your test conditions or indicators do not reflect your visitors: review them. If the field data is good with room to spare, tighten the limits to keep that margin.
Common mistakes
- Budgeting only the Lighthouse score: it is a composite, unstable score that does not tell you what to fix.
- Copying thresholds read elsewhere without measuring your own site: limits that are unreachable, and therefore ignored, or too loose, and therefore useless.
- Tracking twenty indicators: nobody looks at them. A handful is enough.
- A single budget for the whole site: the home page and the product page do not have the same constraints.
- No owner: the overrun is noted, then forgotten.
- Raising the limit at every overrun: the budget follows the drift instead of curbing it.
- Forgetting what escapes the code: tags added in the tag manager, heavy images uploaded by writers, apps installed without measurement.
- Only checking pre-production: third-party scripts and real content are not always present there. Add measurements in production.
Frequently asked questions
What is a performance budget?
A performance budget is a list of numeric limits the site commits not to exceed, per page type: display time, JavaScript weight, number of third-party requests. It is written down, entrusted to a named owner, checked automatically and comes with an overrun rule: optimize the addition, remove something else or give it up. It stops regressions before they reach visitors.
What values should I choose for a performance budget?
For field metrics, use the thresholds published by Google: LCP of 2.5 s, INP of 200 ms and CLS of 0.1 at the 75th percentile. For weights and request counts, there is no universal value. Start from your current measurements so the site gets no worse, then tighten in stages, or aim to beat the best of three to five competitors measured under the same conditions.
Can a performance budget be maintained without continuous integration?
Yes. On WordPress, Shopify, PrestaShop or any site without automated deployment, the check becomes periodic: record each template's indicators every month with the free PageSpeed Insights API, and measure the page concerned before and after each new plugin, app or marketing tag. The difference observed is the cost of the addition, to be weighed against the budget's limits.
Should the Lighthouse score be budgeted?
No. The Lighthouse score is a composite figure, unstable from one run to the next, that does not tell you what to fix. Instead, keep a handful of indicators tied to a decision: lab LCP, Total Blocking Time and CLS, JavaScript weight, total weight, number of third-party requests and of font files. Compare them every quarter with the field Core Web Vitals.
Resources
- web.dev: Performance budgets 101web.dev
- web.dev: Defining the Core Web Vitals metrics thresholdsweb.dev
- Lighthouse CI: Configuration and assertionsgithub.com
- Lighthouse CI: Getting startedgithub.com
- PageSpeed Insights APIdevelopers.google.com
- webpack: performance optionwebpack.js.org
- size-limitgithub.com
Updated on
Topic checklist (PDF)