JSON Minifier
Minify and prettify JSON with size statistics. Compress or format JSON instantly.
JSON input
Minified JSON
Paste JSON to see the minified result with size statistics.
What is JSON Minifier?
A JSON minifier strips every non-essential whitespace character — spaces, line breaks, indentation — from a JSON document while leaving the data itself untouched, producing the smallest text representation that still parses to the exact same value. It's built on JSON.parse() followed by JSON.stringify() with no indent argument, so both directions share one validation path: minifying invalid JSON fails with the same parse error the Formatter would show, rather than a whitespace-only stripper that might mangle malformed input silently. The same tool runs in reverse as a prettifier — JSON.stringify() with a 2-space indent — so you can go from either direction without switching tools. Size is reported before and after as JavaScript's string length (UTF-16 code units), which matches the true byte count for typical ASCII-heavy JSON but slightly undercounts a document full of accented letters, CJK text, or emoji, since those take more than one byte each over the wire.
How to use JSON Minifier
- Paste your JSON into the left panel — it can be formatted, minified, or somewhere in between.
- The minified output appears instantly on the right with size statistics showing bytes saved and reduction percentage.
- Click Copy to grab the minified JSON, or use the prettify option to add formatting back.
- Toggle between minify and prettify modes to compress or expand JSON as needed.
Examples
Formatted JSON → Minified
Input
{ "name": "Production", "replicas": 3, "enabled": true }
Output
{"name":"Production","replicas":3,"enabled":true}
Large JSON → Size savings
Input
{ "users": [ {"id": 1, "name": "Alice", "active": true}, {"id": 2, "name": "Bob", "active": false} ], "metadata": {"count": 2} }
Output
{"users":[{"id":1,"name":"Alice","active":true},{"id":2,"name":"Bob","active":false}],"metadata":{"count":2}}
Minified → Prettified (reverse direction)
Input
{"name":"Production","replicas":3,"enabled":true}
Output
{ "name": "Production", "replicas": 3, "enabled": true }
Common mistakes
- Assuming minification changes numeric or boolean values — minification only removes whitespace, so the parsed output is identical; it doesn't convert numbers to strings or modify data in any way.
- Thinking minified JSON is 'compressed' like gzip — minification removes whitespace but it's still plain text, so combine it with gzip or brotli for additional size reduction.
- Expecting prettify to restore original formatting exactly — prettify adds consistent indentation but canonicalizes formatting rather than reversing minification losslessly.
- Treating the displayed size as an exact wire byte count for a document full of non-ASCII text — the number is a UTF-16 character count, which undercounts real transfer size once accented letters, CJK characters, or emoji are involved.
- Running a line-based diff against a minified file — collapsing everything onto one line makes the diff useless; keep the formatted version around for review and only minify the copy you actually ship.
Why use this tool
- Reports the exact size before and after minification and the percentage saved, instead of requiring you to eyeball or compute the difference by hand.
- Lossless and safe — minified JSON parses identically to the original, with no data transformation or risk beyond whitespace removal.
- Bidirectional — switch between minify and prettify modes to compress or expand JSON as needed, with the same validation and error handling.
- Runs entirely on JSON.parse()/JSON.stringify() in the browser, so minifying a config file or API response that contains secrets never sends those values to a server.
- Minify and prettify share one validation path, so an invalid document is caught with the same parse error in either mode rather than silently producing broken output.