JavaScript Payload Calculator
Assess JavaScript payload size and its parse and execution cost.
About JavaScript Payload Calculator
Compression reduces transfer time but not parse time, because the engine works on the expanded code. That is why bundle size matters twice, and why the parse cost dominates on mobile. JavaScript is byte-for-byte the most expensive resource type, costing far more per kilobyte than images because it must be parsed and executed as well as downloaded.
Formula
JavaScript Payload
Cost = compressed size ÷ bandwidth + uncompressed size ÷ parse rate × CPU throttle
- parse cost
- Depends on uncompressed size, since the engine parses the expanded code
- mobile budget
- About 170 KB compressed is the commonly cited target
Worked example
With the default values below, JavaScript Payload Calculator returns Total JavaScript Cost of 3,216. Change any input above and every figure here is recalculated in your browser.
Inputs used
- Uncompressed bundle sizeminimum 0 KB
- 900 KB
- Compression savingaccepts 0–100 %
- 70 %
- Parse rateminimum 0.01 KB/ms
- 1.2 KB/ms
- Mobile CPU slowdownaccepts 1–10 x
- 4 x
- Connection speedminimum 0.01 Mbps
- 10 Mbps
Results
- Total JavaScript Cost
- 3,216 ms
- Transfer Time
- 216 ms
- Parse and Execute Time on Mobile
- 3,000 ms
- Compressed Size
- 270.0 KB
- Verdict
- Above budget — consider code splitting
Step by step
- 1Values used
- 2JavaScript Payload
- 3Total JavaScript Cost= 3,216 ms
- 4Transfer Time= 216 ms
- 5Parse and Execute Time on Mobile= 3,000 ms
- 6Compressed Size= 270.0 KB
- 7Verdict= Above budget — consider code splitting
Assumptions and limits
- The result is derived only from the 5 inputs listed above. Anything not among them is not part of the calculation.
- In particular, this calculator does not take inflation, tax, fees or charges or compounding frequency into account.
- Figures are rounded for display to 1 decimal place, so totals built from several rounded parts can differ slightly from the unrounded arithmetic.
How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.
Frequently Asked Questions
How is JavaScript Payload calculated?
Cost = compressed size ÷ bandwidth + uncompressed size ÷ parse rate × CPU throttle Compression reduces transfer time but not parse time, because the engine works on the expanded code. That is why bundle size matters twice, and why the parse cost dominates on mobile.
Why does JavaScript Payload matter?
JavaScript is byte-for-byte the most expensive resource type, costing far more per kilobyte than images because it must be parsed and executed as well as downloaded.
What values do I need to enter?
This calculator takes 5 inputs: Uncompressed bundle size, Compression saving, Parse rate, Mobile CPU slowdown, Connection speed. The pre-filled defaults are a realistic starting point — replace them with figures from your own environment for a result you can act on.
Related Calculators
You might also need
- Core Web Vitals Score CalculatorCommonly used together
- Largest Contentful Paint CalculatorCommonly used together
- Page Speed Score CalculatorCommonly used together
- AVIF Savings CalculatorAlso in SEO & Website
- Backlink Growth CalculatorAlso in SEO & Website
- Browser Cache Expiry CalculatorAlso in SEO & Website
