JSON minifier
Strip every byte of insignificant whitespace from a JSON document. The data is untouched — only newlines, indentation, and padding spaces are removed.
Conversion happens in this browser tab. Nothing is uploaded, logged, or stored.
What minifying removes
Every byte of insignificant whitespace: the newlines between keys, the indentation, and the space after each colon and comma. The data is untouched. Parse the minified output and you get exactly the same value back.
Set indent to 0 in the controls above to minify; any other value re-formats instead. The two operations are the same round trip with a different output setting, which is why validity is checked either way.
How much you actually save
Minification typically removes 15–30% of a formatted JSON document, and more from deeply nested ones where indentation dominates. But the honest number is smaller than that, because almost every HTTP response is already gzip- or brotli-compressed, and compression is extremely good at repeated whitespace.
| Version | Raw | After gzip |
|---|---|---|
| Formatted, 2-space | 100% | ~22% |
| Minified | ~72% | ~20% |
Over the wire, minifying on top of compression saves a couple of percent. That is not nothing at scale, but it is not the reason to do it either. The real reasons are: embedding JSON in an environment variable or a single-line log entry, keeping a config blob inside a shell command, or meeting a hard size limit on a field.
To go back the other way, the JSON formatter will expand it again — minifying loses no data, so the round trip is safe.
What you should not do is minify files that humans edit. A minified
config.json in a repository produces diffs that are one enormous changed
line, which makes review impossible.
Minifying from the command line
jq -c '.' input.json > output.min.json
python -c 'import json,sys; json.dump(json.load(sys.stdin), sys.stdout, separators=(",",":"))' \
< input.json > output.min.json
The separators argument matters in Python. Without it,
json.dumps still writes a space after every comma and colon, so you get a
single line that is not actually minimal.
Nothing is uploaded
Minifying is usually the last step before a document gets embedded somewhere awkward: an environment variable, a Kubernetes secret, a CI variable, a single-line argument. Those destinations are precisely where credentials live, so the blob being minified is often the most sensitive thing on the page.
It never leaves your browser. The document is parsed and re-serialised locally, and there is no request carrying it anywhere.