Toolivaro

Free JSON Minifier

Compress JSON to its smallest valid form — strip all whitespace, count the bytes saved, and copy or download.

The JSON minifier reduces a JSON document to its smallest valid representation by removing every byte of insignificant whitespace while preserving the data exactly. Paste formatted or pretty-printed JSON, and the tool returns the compact form with input, output, and savings in bytes and percent — the numbers that matter when you are trimming a config file, an API payload, or a stored blob. The result is generated by parsing and re-stringifying, so the minified output is guaranteed to be valid and semantically identical to the input: the same data, the same key order, the same numbers. Copy and download actions make it easy to drop the result into code or a file. Everything runs locally in your browser: pasted JSON never leaves your device, is never logged, and is never transmitted — essential for tokens and configuration that must not leak. Use this tool before committing configuration, shrinking embedded payloads, or when an API or storage quota counts bytes.

Processed locally in your browser

Processed locally in your browser — pasted JSON is never uploaded, logged, or stored.

How to use this calculator

What minification does — and what it does not touch

Minification removes every byte of whitespace between JSON tokens: the indentation, the line breaks, the padding after colons and commas that a formatter added. Whitespace outside string values is insignificant in JSON, so removing it changes nothing about the data — the same values, the same keys, the same order — while making the document as small as the format allows. The tool parses and re-serializes the document rather than editing text, so the output is guaranteed to be valid JSON and semantically identical to the input: the minifier cannot corrupt a document the way a text-based find-and-replace could.

That guarantee is the reason to prefer parse-and-stringify over a clever regex: number representation is preserved, key order is preserved, and the result is always a document the platform can parse again. The savings panel reports input bytes, output bytes, and the percentage saved, so the decision to ship the minified form is made on real numbers.

Where the bytes actually matter

Minification pays off wherever JSON crosses a boundary with a cost: an embedded config in a shipped product (the saving multiplies across every device and every fetch), a payload measured against an API quota, a stored blob billed by size, or a fixture committed to a repository where every byte stays in history. The worked example is typical: a 412-byte pretty-printed config minifies to 301 bytes — 27% smaller, with the same data.

The honest counter-case is also worth knowing: if the input is already compact, re-serialization can add a few bytes (re-escaping a character, for instance), and the tool reports a negative saving rather than hiding it. Minification is a formatting choice with measurable results, and the panel shows the true number in both directions.

The format that travels well

A minified document is still valid JSON, so it can be formatted back to readable indentation at any time — formatting and minifying are exact inverses for valid documents, which is why the JSON formatter and minifier are linked pages. The compact form is also the better base for a second, independent compression step: transport compression (gzip, brotli) works on the bytes after minification, and starting from the smallest valid form means the transport layer has less redundancy to remove.

The two caveats are worth keeping: minification removes whitespace only — it does not rename keys, strip comments (JSON has none), or compress values — and very large documents take a moment to process, so the tool is designed for typical configs and payloads rather than database dumps.

The local promise

Config files and payloads often contain tokens, internal endpoints, and other text that must not leak, and minifying is a job no service needs to see. Everything runs in your browser: the document is parsed and serialized locally, nothing is uploaded, logged, or stored, and copy and download actions deliver the result wherever it is needed.

How is the result calculated?

Trimming a pretty-printed config file

A pretty-printed config weighs 412 bytes in 14 lines; its minified form is 301 bytes — 27% smaller. For a config shipped to thousands of devices, that saving multiplies across every install and every fetch. The minified result remains valid JSON and can be formatted again at any time with the JSON formatter.

Example input and output
Input Value
json { "retries": 3, "timeoutMs": 5000, "features": { "cache": true } }
Result 412 B → 301 B (−27%) · valid JSON · identical data

What is the formula and its assumptions?

Minification method

minify(json) = JSON.stringify(parse(json))

Formula terms
Symbol Meaning
parse standard JSON parser
stringify serialization without whitespace

Whitespace outside strings is insignificant in JSON, so removing it never changes the data.

Size savings

savings % = (input bytes − output bytes) / input bytes × 100

Formula terms
Symbol Meaning
input bytes UTF-8 size of the input document
output bytes UTF-8 size of the minified document

What are the most common mistakes?

  • Minifying JSON that is not valid in the first place — the tool validates before compressing and reports the exact problem.
  • Assuming minification shrinks every document; already-compact inputs can grow by a few bytes.
  • Using an online minifier that uploads the document — this tool keeps everything on your device.

What are the assumptions and limitations?

  • Minification removes whitespace only; keys, values, and structure are preserved as-is.
  • Very large documents may take a moment; the tool is designed for typical configs and payloads.
  • Output uses compact serialization; gzip-style compression of the result is a separate step.

Where do the numbers come from?

Last reviewed August 4, 2026 · Version 1.0.0 · Toolivaro does not guarantee external content.

Frequently asked questions

Does minification change my data?

No. The minifier parses and re-serializes the document, which preserves values, key order, and number representation exactly. Whitespace between tokens is insignificant in JSON, so removing it is lossless.

Why is my minified output sometimes larger?

If the input is already compact, re-serialization can add a few bytes (for example re-escaping characters). The savings percentage can be negative on such inputs — the tool reports the true numbers instead of hiding them.

Can minified JSON be formatted back?

Yes — the minified form is valid JSON, so the JSON formatter restores readable indentation at any time. Formatting and minifying are exact inverses for valid documents.

Does the minifier remove comments?

JSON has no comments — a document containing them is not valid JSON and is rejected with the parser’s error. Files like tsconfig or package.json use JSONC or JSON5 variants that allow comments; those are outside the JSON standard this tool follows.

Why is the savings percentage negative sometimes?

When the input is already compact, re-serialization can add a few bytes — for example re-escaping a character or normalizing a number’s formatting. The tool reports the true change rather than a floor of zero.

Part of Developer text and JSON toolkit

Found a mistake or have a correction? Report it — we review every correction.

Was this helpful?

Reviewed by the Toolivaro editorial team per our methodology Methodology · Editorial policy