How to minify JSON
- Paste JSON or press Open file.
- Press Minify or Ctrl + Enter.
What it removes
Every space, tab and line break between keys, values and brackets. Strings keep their inner spaces, numbers their exact digits, and keys their order. For sorted keys on one line, press Sort keys, then Minify.
Escape sequences come out in their shortest form: \u00e9 becomes é and \/ becomes /, while \" and \t stay. The parsed strings are the same.
Example
A webhook payload, pretty printed (319 bytes, 14 lines):
{
"event": "checkout.completed",
"id": "evt_8KD2",
"created": "2026-11-04T18:22:05Z",
"data": {
"cart_id": "c_5521",
"total": 86.40,
"currency": "EUR",
"items": [
{ "sku": "BAG-07", "qty": 1, "note": "gift wrap, no receipt" },
{ "sku": "SOCK-3P", "qty": 2, "note": null }
]
}
}
Minified, 242 bytes (24% smaller):
{"event":"checkout.completed","id":"evt_8KD2","created":"2026-11-04T18:22:05Z","data":{"cart_id":"c_5521","total":86.40,"currency":"EUR","items":[{"sku":"BAG-07","qty":1,"note":"gift wrap, no receipt"},{"sku":"SOCK-3P","qty":2,"note":null}]}}
Minify or gzip
Compression narrows the gap: with Node.js defaults, the example is 233 bytes pretty and 207 minified under gzip, or 205 against 166 under Brotli. Minifying still pays off where nothing is compressed: environment variables, query strings, local storage, and logs with one record per line.
Minified is not canonical. Key order and number spelling stay as written, so two systems can minify the same data to different bytes. For hashing or signing, use RFC 8785, the JSON Canonicalization Scheme.
To embed the result in another JSON string, use JSON escape. To indent it again, use JSON pretty print.
Minify JSON in code
- JavaScript:
JSON.stringify(JSON.parse(text)) - Python:
json.dumps(data, separators=(",", ":")). The default separators add a space after each comma and colon.
Both parse the numbers first, so 86.40 comes out as 86.4.
When it fails
Minify needs valid JSON; the Report tab shows the line and column of the first error. Comments, common in files like tsconfig.json, can be stripped with JSON repair. The JSON validator explains other errors.