- Home
- Tools
- Developer Tools
- JSON Formatter
- JSON Minifier
JSON Minifier
Strip the spaces and line breaks out of JSON to get the smallest text with the same content. Numbers are left exactly as written.
Nothing to paste? , or .
Result
What minifying takes out
Between the values, keys and brackets of a JSON text, spaces, tabs and line breaks mean nothing. They are there for people. A minifier removes all of them and leaves the content as it was:
{
"city": "New York",
"open": true,
"rating": 4.50,
"tags": [
"coffee",
"wifi"
],
"id": 12345678901234567890
}{"city":"New York","open":true,"rating":4.50,"tags":["coffee","wifi"],"id":12345678901234567890}What has to stay
- White space inside strings. The space in
"New York"is data. - Every quote, comma, colon and bracket. JSON has no shorter spelling for them, and keys cannot lose their quotes.
- The order of the keys and of the items in a list.
Numbers are copied, not recalculated
Many minifiers read the JSON into memory and write it out again. Numbers change on the way: in JavaScript 4.50 comes back as 4.5, 1e3 as 1000, and the 20-digit ID 12345678901234567890 as 12345678901234567000, which is a different ID.
This minifier copies every number character for character, as the example shows. Strings are written in their plain form, so an escape like \u00e9 becomes é: the same text in fewer bytes. Tick Escape non-ASCII if you need it the other way round.
How much it saves
That depends on how the text was indented. Deeply nested data with four-space indentation shrinks the most. If your server compresses its responses with gzip or Brotli, the gain on the wire is much smaller than the byte counts suggest, because runs of spaces compress to almost nothing.
Minify what goes over the network, and keep the indented version wherever people read or compare the file.
The JSON formatter page has the rules of JSON in full, what Repair fixes, and why large numbers need care.