JSON Minifier
Remove all the spaces and line breaks from valid JSON and see how many bytes that saves.
{"name":"Ana","tags":["a","b"],"active":true}Private: Everything runs in this page. Nothing you type is sent anywhere or saved.
On this page
Minify examples
| JSON | Minified | Saved |
|---|---|---|
| { "a": 1 } | {"a":1} | 30% |
| [ 1, 2, 3 ] | [1,2,3] | 36.4% |
| { | "k": [ true, null ] | } | {"k":[true,null]} | 29.2% |
| "text" | "text" | 0% |
| { "a" : { "b" : 2 } } | {"a":{"b":2}} | 38.1% |
Formula
How the json minifier works
- Step onePaste valid JSON.
- Step twoThe minified text appears at once, with the size before and after.
- Step threeCopy the result.
What this tool does not do
- It does not shorten names or values; only whitespace is removed.
- Very large numbers lose exactness, as in the browser's own JSON handling.
- It does not compress with gzip or any other method.
Frequently asked questions
Does minifying change the data?
Only the spaces and line breaks between the values go, and text inside strings is untouched. Two things can still change, and the tool tells you when they do: a number with more digits than a browser can keep exactly is shown as the nearest value it can store, and a key that appears twice keeps only its last value. Numbers are also written in the shortest form (1.0 becomes 1) with the same value.
Why does it say my JSON is invalid?
JSON needs double quotes around names and text, no trailing commas and no comments. The message shows what the browser found.
How is this different from the JSON formatter?
The formatter makes JSON easy to read and can also minify. This tool is for minifying only and shows how many bytes were saved.