JSON Minifier.
Compress JSON to a single line and see exactly how many bytes you save. Lossless, instant, and 100% private — it all runs in your browser.
No signup · No uploads · Free forever
Output
// Paste JSON and press “Minify JSON”. Minify and compress JSON online — free and lossless
A JSON minifier removes every byte of unnecessary whitespace — spaces, tabs, and newlines — to make your JSON as small as possible. Paste your JSON above and press Minify JSON; the tool compresses it to one line and reports the before-and-after size plus the percentage saved. The result is byte-for-byte equivalent data, just smaller.
Why compress JSON?
- Faster transfers. Smaller API responses and bundles load quicker and cost less bandwidth.
- Production payloads. Minified JSON is the standard form for data shipped to clients.
- Storage. Compact JSON takes less room in databases, caches, and logs.
Minifying is lossless — here is exactly what it removes
Minification strips only the whitespace between tokens, which JSON parsers ignore. Nothing inside your strings is touched, and no key, value, type, or ordering changes:
{
"user": {
"name": "Ada Lovelace",
"roles": [ "admin", "dev" ]
}
} becomes:
{"user":{"name":"Ada Lovelace","roles":["admin","dev"]}}
The space inside "Ada Lovelace" survives, because it is part of
the data. Parse both and you get an identical object — which is why
minifying is always safe, and always reversible with the JSON formatter.
Minifying is not the same as compressing
This is the most common misunderstanding, and it matters if you are trying to make an API faster.
Minifying removes whitespace and gives you a smaller but still readable JSON document — typically 10–30% smaller, depending on how deeply indented the original was.
Compression (gzip or Brotli) is a binary encoding applied on top, usually by your web server, and routinely achieves 70–90%. It is a far bigger win.
They stack, but with diminishing returns: compression algorithms are extremely good at collapsing repeated whitespace, so gzipping a pretty-printed file gets you most of the way there on its own. Minify anyway — it is free — but if your payload is slow, enable compression first. That is where the real saving is.
Minify JSON in code
JavaScript — simply omit the indent argument:
JSON.stringify(data); // minified
JSON.stringify(data, null, 2); // pretty-printed Python — you must set the separators, or you keep a space after every comma and colon:
import json
json.dumps(data, separators=(",", ":")) # truly minified Command line:
jq -c . data.json > data.min.json When not to minify
Never minify JSON you commit to git. A minified file is a single line, so changing one field makes git report the whole file as rewritten — code review becomes impossible and merge conflicts become unresolvable.
The rule: format what you commit, minify what you ship. Keep the repository copy pretty-printed and minify at build time for the bytes that actually travel over the network.
Minify, then expand whenever you need
Minification is fully reversible: run the output back through the JSON formatter to pretty-print it again. You can also validate first to be sure the input is well-formed, or view it as a tree. Learn more in minify vs. pretty-print JSON.
FAQ
JSON minifying, answered.
How do I minify JSON online? +
Paste your JSON into the minifier above and press Minify JSON. The tool strips every unnecessary space, tab, and line break to produce a compact single-line document, and shows how many bytes you saved. Copy it or download it as data.min.json.
Does minifying JSON change the data? +
No. Minifying only removes insignificant whitespace between tokens. The parsed value is identical — same keys, same values, same structure. It is completely lossless.
Why minify JSON? +
Smaller JSON means faster network transfers and less bandwidth, which matters for API responses, config bundled into apps, and data sent to browsers. Minified JSON is also the standard form for production payloads.
Is minified JSON still valid? +
Yes. Whitespace in JSON is optional, so a minified document is exactly as valid as its pretty-printed version. You can re-expand it any time with the JSON formatter.
Is my JSON uploaded when I minify it? +
No. Minification runs entirely in your browser. Your data never touches a server, so it is safe for private payloads and secrets.
How much smaller does minifying JSON make my file? +
Typically 10-30% for pretty-printed JSON, depending on how deeply nested it is — the more indentation, the more whitespace there is to strip. The tool shows you the exact byte count before and after. Combined with gzip or Brotli compression on your server, the practical saving over the wire is smaller, because compression algorithms already handle repeated whitespace well.
Does minifying JSON lose any data? +
No, it is completely lossless. Minification only removes whitespace between tokens, which JSON parsers ignore. Every key, value, type, and ordering is preserved exactly — parse the minified output and you get an object identical to the original.
When should I minify JSON and when should I not? +
Minify what you send over the network: API responses, embedded config in HTML, and anything a user downloads. Do not minify JSON you commit to git — a minified file is a single line, so every change looks like the whole file was rewritten and code review becomes impossible. Keep the repository copy pretty-printed and minify at build time.
Is minifying JSON the same as compressing it? +
No, and this trips people up. Minifying removes whitespace, producing a smaller but still human-readable JSON document. Compression (gzip, Brotli) is a binary encoding applied on top, usually by your web server, and yields far bigger savings. They stack: minify first, then let the server compress.