JSON Payload Size & Byte Budget Calculator
Inspect one JSON document as UTF-8 text. Compare original spacing, compact JSON and an indented form without passing numbers through a serializer. Find how much of the input comes from whitespace and how many separate identical document payloads fit in an entered byte budget. The worksheet runs in this page and keeps the source out of the metrics CSV.
Compare JSON bytes without changing values
Inspect original spacing, compact JSON and the chosen indentation against one payload budget.
Only Compact fits the entered copy count and byte budget.
Batch bytes against one budget
28 bytes over budget · at most 2 copies
14 bytes remaining · at most 3 copies
64 bytes over budget · at most 2 copies
- JSON punctuation
- Strings, numbers and literals
- Layout whitespace
Open byte breakdown
Object · 17 significant tokens · depth 2 · 73 UTF-16 units · 72 code points.
| Bytes | As entered | Compact | Indented |
|---|---|---|---|
| Per document | 76 | 62 | 88 |
| Punctuation | 10 | 10 | 10 |
| Literal and string bytes | 52 | 52 | 52 |
| Layout whitespace | 14 | 0 | 26 |
Open compact and indented JSON
Show selectable metrics CSV
How to use this calculator
- Paste one valid JSON value into the local editor. Objects, arrays and individual JSON values are supported.
- Enter a payload byte budget, the number of identical copies to compare, and an indentation style.
- Compare bytes and maximum copies for the entered, compact and indented forms. Open the JSON text options when you need to copy either transformation.
- Use the metrics CSV to record the sizes and assumptions without including your source data.
The Formula
The mathematical logic powering this calculation is:
Count UTF-8 bytes from the supplied text. JSON punctuation marks are counted as structural bytes. Strings, names, literals and numbers retain their original token spelling and are counted as content bytes. Compact format removes only the JSON grammar's insignificant ASCII space, tab, carriage return and newline. Indented format reinserts spaces and line feeds around tokens without changing their order or spelling. The parser validates one JSON value. It does not use its parsed numeric values to produce either output. Escapes, duplicate name occurrences, numeric exponents, negative zero and numbers beyond JavaScript’s exact integer range therefore remain as supplied. RFC 8259 notes duplicate names can be interpreted differently by receivers.
Batch bytes = one payload bytes × entered identical copies. Remaining budget = entered budget − batch bytes. Maximum copies = budget divided by one payload size, rounded down. Copies are separate document payloads. No transport headers, delimiters, compression, surrounding array, BOM, newline framing or envelope are added. The textarea measures the text currently held in this editor; browser pasting can normalize line endings before the app receives it.
The input limit is 65,536 UTF-16 units and 64 nested array or object levels. Byte budget is 1–1,000,000,000 bytes and count is 1–1,000,000 copies. Raw unpaired UTF-16 is rejected; authored JSON escapes stay verbatim. Spaces within a quoted string always count as content. Code points and UTF-16 units are separate from bytes.Worked Example
If you input:
- JSON source: City Zürich, status 🌱, two numeric IDs
- Budget: 200 bytes
- Number of copies: 3
- Indentation: Two spaces
Result:
The entered source is 76 UTF-8 bytes. Compact JSON is 62 bytes and indented JSON is 88 bytes. Three compact documents use 186 bytes and leave 14 bytes. Three entered documents use 228 bytes.
Frequently Asked Questions
Why are characters and bytes different?
UTF-8 uses one to four bytes for Unicode scalar values. A single visible character can also contain multiple code points or two UTF-16 units.
Will compacting round a long ID or change scientific notation?
The tool preserves numeric tokens exactly, even when a receiver would approximate the parsed result. The only edits are to structural whitespace.
What happens to whitespace inside a string?
It remains in the string token. A literal space, newline escape or tab escape keeps its bytes and spelling.
Is the compact value canonical JSON?
It keeps the entered object order, duplicate name occurrences and escape spellings. A canonical format may prescribe additional rules.
Do the totals include commas between payloads or compressed size?
The budget adds separately encoded document text only. Protocol framing and compression affect actual transfers and depend on the destination.
Does this send the source document anywhere?
The editor and its calculations run locally. The generated CSV records counts and labels; the two selectable text outputs contain your data.
Similar Calculators
Data Transfer Time Calculator
Estimate file upload, backup, copy, or migration time from data size, throughput, overhead, and batches.
Bytes to Kilobytes Calculator
Convert bytes to kilobytes instantly with a clean, one-field converter.
IOPS & Storage Workload Capacity Planner
Compare two storage options for one read/write workload. Find which IOPS, bandwidth or outstanding I/O limit binds at your entered latency.
