JSON size analyzer — bytes, nesting depth and the heaviest keys

Paste a JSON document to see its exact size in UTF-8 bytes, how much smaller it would be minified, how deep it nests, how many keys it holds, and which top-level keys take up the most space.

Live demo · real result from this tool
Size195 B
Bytes (exact)
195
Minified size
160 B
Formatted size (2 spaces)
217 B
Max depth
2
Keys
9
Unique key names
9
Largest array
2
Longest string
16 chars

Values by type

01.534.56ObjectsArraysStringsNumbersBooleansNulls

Size of each top-level key

KeyTypeBytes (minified)
addressobject35
emailstring18
rolesarray18
namestring10
idnumber4
activeboolean4
lastLoginnull4

Processed on your device — nothing is uploaded.

How to use the JSON size analyzer

  1. Paste your document into JSON. It can be minified or formatted.
  2. Read the figures: Size and Bytes (exact) for the text as pasted, then Minified size and Formatted size (2 spaces) for comparison.
  3. Check the structure figures: Max depth, Keys, Unique key names, Largest array and Longest string.
  4. Look at the Values by type chart and, for an object root, the Size of each top-level key table, sorted largest first.

If the JSON is invalid, you get the line, column and reason instead of figures.

What it does and when to use it

Use it before you ship a payload: an API response that feels slow, a config file pushed to thousands of devices, a localStorage value near its quota, or a message that must fit under a queue or webhook size limit. The top-level key table shows where the weight sits, so you know whether to paginate an array, drop a field or shorten keys.

The difference between Size and Minified size is the whitespace you would save with the JSON minifier. To see every path in a large document, use the JSON key extractor; to compare two versions of a payload after trimming it, use JSON diff.

How it works

The text is parsed with the browser’s JSON.parse. Sizes are measured by encoding text to UTF-8 with TextEncoder, so they are real byte counts, not character counts. The minified and formatted sizes come from re-serialising the parsed value with JSON.stringify (no spaces, then two-space indent). A single walk through the value counts objects, arrays, strings, numbers, booleans and nulls, tracks the deepest level, the longest array and the longest string. Byte figures above 1,023 are shown in KB and MB using 1,024 as the step.

Worked examples

A paged API response, pasted minified:

{"meta":{"page":1,"total":3},"items":[{"id":1,"title":"Café menu"},{"id":2,"title":"Order"},{"id":3,"title":"Bill"}]}
Size: 118 B                    Formatted size (2 spaces): 223 B
Max depth: 3                   Keys: 10    Unique key names: 6
Key | Type | Bytes (minified)
items | array | 80
meta | object | 20

The three item objects account for 80 of the 118 bytes, and pretty-printing nearly doubles the size. The 118 bytes include one extra byte for the “é” in “Café”.

A single string "é" is 4 bytes: two quote marks and two bytes for the accented letter.

Limits and tips

  • The per-key table appears only when the root is an object, and its figure covers the minified value only, not the key name, colon or comma.
  • Very large files are read fully into browser memory and can make the page pause while they parse.
  • Numbers are counted as they parse. Integers beyond 2^53 lose precision in JavaScript; the JSON validator warns about them.
  • Nothing is uploaded; all counting happens on your device.

Frequently asked questions

Is the size the same as what my API sends over the network?
It is the size of the text you pasted, encoded as UTF-8, which is what a server sends before compression. Most servers gzip or Brotli-compress JSON responses, and this tool does not estimate the compressed size.
Why is my JSON bigger in bytes than in characters?
UTF-8 uses one byte for plain ASCII but two to four bytes for other characters. "é" is two bytes, many Indian and Chinese scripts take three, and most emoji take four. The Longest string figure counts characters, not bytes.
How is Max depth counted?
Each object or array you step into adds one level. A plain value such as 42 has depth 0, a flat object has depth 1, and an array of objects inside an object has depth 3.
What is the difference between Keys and Unique key names?
Keys counts every key in every object. Unique key names counts distinct names. An array of 1,000 records with the same 5 fields has 5,000 keys but only 5 unique names, which tells you a columnar format or shorter key names could save space.

Written by the ToolsRift team · Last updated

Pages are drafted with AI assistance and checked by automated tests. How we write and check pages.

Was this tool useful?

Report a problem

Start typing to search every tool.

↑ ↓ to moveEnter to openEsc to close