How to minify JSON
- Paste your JSON into the input.
- The minified version appears instantly, with the size before and after.
- Optionally sort keys for a canonical form.
- Copy or download the result.
Example
{
"id": 42,
"tags": ["a", "b"]
}
becomes
{"id":42,"tags":["a","b"]}
When to minify JSON
- Embedding JSON in HTML, URLs or environment variables.
- Storing JSON in databases or caches where every byte counts.
- Producing a canonical form (with sorted keys) to hash or compare documents.
Frequently asked questions
Does minifying change my data?
No. Minification only removes whitespace between tokens. Keys, values, strings (including spaces inside them) and order stay exactly the same.
How much smaller does JSON get?
It depends on how it was formatted. Pretty-printed JSON with 2-space indentation typically shrinks by 15–30%; deeply nested documents shrink more.
Should I minify JSON for APIs?
Usually your server's gzip or Brotli compression already removes most of the cost of whitespace. Minifying still helps for JSON embedded in HTML, stored in databases or size-limited fields.