← Blog

JSON Size Calculator — Bytes & Minify Savings

JSON formatter blog · Open JSON Formatter

JSON size panel comparing pretty-printed and minified byte sizes
JSON Size Calculator — Bytes & Minify Savings

A JSON size calculator shows how large a JSON document is before you send it, store it, download it, or paste it into another tool. JSON Formatter & Converter includes a browser-side size panel for characters, UTF-8 bytes, pretty size, minified size, depth, key count, and null count. It is free, no signup is required, and the calculation runs in your browser.

Size matters when a payload has to fit an API limit, a field limit, an email-safe sample, a log attachment, or a quick review. A document can look small in an editor but still contain thousands of repeated keys, multi-byte characters, deeply nested objects, or whitespace added by formatting. The size panel gives you a practical view of the current JSON so you can decide whether to minify, strip nulls, flatten, split, or download a different version.

What a JSON size calculator reports

JSON size can mean a few different things. A simple character count is useful, but it does not always match the number of bytes sent over the wire or saved to a file. That is why Tools Viewer shows several measurements side by side.

  • Characters: the number of text characters in the current document.
  • UTF-8 bytes: the byte length of the document when encoded as UTF-8, which matters for many file and request limits.
  • Pretty size: the size of readable, indented JSON.
  • Minified size: the size after unnecessary whitespace is removed.
  • Depth: how deeply objects and arrays are nested.
  • Key and null counts: useful signals for repeated fields and optional values that may be safe to clean up.

How to check JSON size online

  1. Open JSON Formatter & Converter.
  2. Paste JSON, open a local file through the browser, or use Import URL when the remote host allows CORS.
  3. Use Validate or Format if you want to confirm the document parses cleanly.
  4. Review the size panel for characters, UTF-8 bytes, pretty size, minified size, depth, keys, and nulls.
  5. Use Minify, Strip nulls, Sort keys, Flatten, Compare, Convert, or Download depending on your next step.

Pretty JSON vs minified JSON

Pretty JSON is easier to read because indentation and line breaks show structure. Minified JSON is smaller because it removes whitespace that parsers do not need. The values are the same, but the byte count can be very different.

Pretty JSON:

json
{
  "ok": true,
  "items": [
    "alpha",
    "beta",
    "gamma"
  ]
}
{
  "ok": true,
  "items": [
    "alpha",
    "beta",
    "gamma"
  ]
}

Minified JSON:

json
{"ok":true,"items":["alpha","beta","gamma"]}
{"ok":true,"items":["alpha","beta","gamma"]}

For human review, keep the formatted version. For a compact download, request body, or pasted sample where readability does not matter, minify the document and check the size panel again. If the difference is small, the document may already be compact or the repeated data may be in keys and values rather than whitespace.

Why UTF-8 bytes can differ from characters

Many tools display text as characters, but storage and transfer limits are often measured in bytes. Plain ASCII characters usually take one byte in UTF-8. Many other characters take more. That means a JSON file with names, symbols, accented text, or non-Latin scripts can have a byte size larger than its visible character count.

json
{
  "message": "Hello",
  "city": "Sao Paulo",
  "currency": "EUR"
}
{
  "message": "Hello",
  "city": "Sao Paulo",
  "currency": "EUR"
}

The exact byte count depends on the characters in your real document. The useful habit is simple: check UTF-8 bytes when you are working with a hard payload limit, and check character count when you are comparing text length for display or review.

This distinction matters most when the payload includes names, product descriptions, messages, emoji, currency symbols, or translated text. Two JSON documents can have a similar number of visible characters but different byte counts once encoded. When a service says a field, file, request body, or message must stay under a byte limit, use the byte number rather than the character number.

Ways to reduce JSON size

The right reduction depends on why the payload is large. If it is pretty-printed, Minify is the fastest win. If it contains many optional fields set to null, Strip nulls may help. If it repeats the same nested structure thousands of times, you may need to change the data shape rather than just the formatting.

  • Minify: remove unnecessary whitespace before sending or storing the payload.
  • Strip nulls: remove null fields when those fields are optional and the receiving system does not require them.
  • Sort keys: make repeated objects easier to scan and compare before cleanup.
  • Flatten: turn nested data into path-like keys when you need a table-style view or CSV export.
  • Convert: export to CSV, TSV, YAML, XML, TypeScript, C#, Java, or another supported format when the target workflow needs something other than JSON.
  • Download: save the version you reviewed so you do not lose the exact output.

Be careful with reductions that change meaning. Removing whitespace is safe for valid JSON because whitespace outside strings is not data. Removing nulls can change meaning when a system treats an explicit null differently from a missing key. Flattening can change how nested arrays are represented. Conversion to XML, CSV, YAML, TypeScript, C#, Java, and similar formats is best-effort and should be reviewed before use in a strict workflow.

Troubleshooting surprising JSON sizes

If a document is larger than expected, look for repeated keys first. Arrays of objects repeat every field name on every row, so a thousand small records can still become a large file. Pretty indentation adds visible bulk, but repeated property names, long IDs, large strings, and embedded encoded content are often the real source of size.

If minifying barely changes the byte count, the payload was probably already compact or the data itself dominates the document. In that case, use Tree view to identify large branches, sort keys to compare repeated shapes, or flatten a sample to see which paths carry the largest values. If the payload contains an escaped JSON string inside another JSON object, parse that string before measuring the inner structure.

If the size panel cannot report useful numbers, validate the document first. A missing brace or invalid quote can stop parsing, which means depth, key count, null count, and minified size cannot be trusted until the syntax is fixed.

Use size with validation, tree view, and compare

Size is most useful when paired with structure. If the size panel shows a surprising number of keys or a high nesting depth, use Tree view to expand the large sections instead of scrolling through raw text. If two versions of a payload have different byte counts and you need to know why, use Compare after formatting and sorting keys.

If the JSON does not parse, fix validation first. The validate JSON online guide explains common syntax issues such as trailing commas, comments, single quotes, and unquoted keys. If the source is JSON Lines or NDJSON, convert it first with the JSONL to JSON workflow so the size panel can evaluate one complete JSON document.

Import URL and privacy

You can paste JSON directly, open a local file in the browser, or use Import URL for a remote resource. Import URL is a browser fetch from your device to the remote host. It works only when that host allows the request with CORS. Tools Viewer does not proxy blocked URLs, so if an import fails, paste the content or open a downloaded file locally.

Size calculations, formatting, validation, minifying, sort keys, strip nulls, stringify, parse string, flatten, unflatten, tree view, compare, conversion, and downloads run in your browser. The tool is free, and no account is required. Your pasted JSON is not uploaded just to calculate its size.

When to use the calculator

Use the size panel before sending a request body, attaching a sample to a support ticket, sharing a fixture, converting a log export, or saving a compact version for later. It is also useful while editing: format while you work, then minify at the end and compare the pretty and minified byte counts before downloading.

If your JSON comes from a Python literal, convert it with Python dict to JSON first. If you need an XML handoff, use the JSON to XML converter workflow after validating and checking size. Keeping the size step close to conversion helps you spot payload growth before it becomes a limit error somewhere else.

Honest limits of size checks

The size panel tells you about the JSON text in the browser. It does not know every limit that may apply later, such as request headers, multipart wrappers, database field overhead, file metadata, or transport compression. Treat the reported size as the JSON document size, then compare it with the exact rule from the system receiving the data.

FAQ

Is there a free JSON size calculator?

Yes. JSON Formatter & Converter includes a free size panel for characters, UTF-8 bytes, pretty size, minified size, depth, keys, and nulls.

Does the calculator measure UTF-8 bytes?

Yes. It reports UTF-8 byte length alongside character count, which is useful when payload limits are measured in bytes.

Does minifying JSON always make it smaller?

Minifying removes unnecessary whitespace from valid JSON. It usually shrinks pretty-printed JSON, but already compact JSON may change very little.

Can I reduce size by stripping nulls?

Yes, when null fields are optional for your workflow. Review the result because removing nulls can change meaning for some systems.

Why is my JSON still large after minifying?

Whitespace may not be the main source of size. Long strings, repeated keys, embedded data, and large arrays can dominate even after minification.

Can I calculate JSON size from a URL?

Yes, with Import URL when the remote host allows browser fetches with CORS. The fetch runs from your browser and Tools Viewer does not proxy it.

Is my JSON uploaded to calculate size?

No. Size checks, formatting, validation, conversion, and downloads run in your browser, with no signup required.

Related: JSON formatter online, validate JSON online, JSONL to JSON, and convert JSON to XML. Full walkthrough: JSON Formatter guide. More posts: JSON formatter blog.