How to minify JSON
- Paste your JSON into the box, such as a config file or an API response.
- Select Minify JSON. The tool does not update as you type.
- Read the count under Result, then select Copy result.
For example, a five-line object with two-space indents holding a name, an age and a tags array comes out as {"name":"Ada","age":36,"tags":["admin","dev"]}. The tool reports 60 characters to 46, with 14 removed. Every key and value is the same. Only the layout changed.
When one-line JSON is useful
- Pasting a request body into a curl command or an API testing tool.
- Storing JSON in a single-line field, such as an environment variable or a database column.
- Writing log files where each record must sit on its own line.
- Making a large file smaller before you save it or send it.
What changes and what stays the same
The tool reads your JSON with JSON.parse and writes it back with JSON.stringify. That removes all whitespace outside strings. It also rewrites a few values in a standard form, as these real results show:
| You paste | You get | What happened |
|---|---|---|
| [ 1, 2, 3 ] | [1,2,3] | Spaces removed |
| {"note": "two spaces"} | {"note":"two spaces"} | Spaces inside strings kept |
| {"price": 1.50} | {"price":1.5} | Trailing zero dropped |
| {"n": 1E3} | {"n":1000} | Exponent written out |
| {"a": 1, "a": 2} | {"a":2} | Duplicate key: last value wins |
| {"id": 12345678901234567890} | {"id":12345678901234567000} | Very large number rounded |
Whole numbers above 9,007,199,254,740,991 lose precision, so keep long IDs in quotes. Escapes like \u00e9 are turned into the real character, which also counts toward the characters removed. The JSON Formatter page explains these parser changes in more detail.
When the JSON is invalid
If parsing fails, the result area shows Invalid JSON followed by your browser's error message, and no output is produced. Comments, trailing commas, single quotes and unquoted keys are all rejected, because strict JSON does not allow them. In Chrome, {"a": 1,} gives a message that ends with (line 1 column 9). The wording differs between browsers. For a clearer line and column, check the text with the JSON Validator first.
Size, speed and getting the format back
Savings depend on how much indentation the JSON has. Deeply nested, pretty-printed files shrink the most. The counter shows characters, not bytes, so text with accents or emoji takes more bytes than the count suggests.
Servers and APIs usually compress responses with gzip or Brotli, and compression already handles repeated spaces well. Minifying still trims what has to be parsed and stored, but the saving on the network is smaller than the counter shows. Minifying is also easy to reverse: the JSON Formatter adds indentation back, and the data is unchanged apart from the rewrites in the table above.
Common Mistakes to Avoid
Pasting JSON with comments or trailing commas
Solution:
Minifying data that holds long numeric IDs
Solution:
Thinking minified JSON is hidden or secure
Solution:
Editing the minified copy by hand
Solution:

