When to minify JSON
Pretty-printed JSON is easy to read but carries a lot of whitespace: indentation and line breaks can be a third of a file. Minified JSON drops everything outside strings that does not change the data. It is what you want in environment variables, query parameters, HTTP request bodies, and anywhere a value must fit on one line.
For data sent over HTTP with gzip or Brotli compression, the size difference after compression is small, so minifying matters most for storage limits and single-line fields.
Worked example
{
"id": 42,
"tags": ["a", "b"],
"note": "keep these spaces"
}
minifies to {"id":42,"tags":["a","b"],"note":"keep these spaces"}, from 69 to 55 bytes. The double spaces inside the string are data, so they stay.
How this works
The input is parsed with the strict JSON parser used by the other JSON tools, so invalid input is reported with its line and column rather than minified into something broken. The parsed value is then written back without any optional whitespace. Numbers come out in JavaScript's shortest form (1.50 becomes 1.5), escapes are normalised, and key order is kept. The byte counts are UTF-8 lengths of the input and the output. Everything runs in this tab.
Frequently asked
Does minifying change the data?
No. Only whitespace outside strings is removed. Numbers may be written more briefly, such as 1.0 as 1, with the same value.
How much smaller will it get?
Typically 10–40% for indented files. The page shows the exact byte counts.
Can I undo it?
Yes: paste the result into the JSON formatter to indent it again.
Is my JSON uploaded?
No. Everything runs in your browser.
Sources
- RFC 8259 — The JavaScript Object Notation (JSON) Data Interchange Format
- ECMA-262 — ECMAScript Language Specification
- Wikipedia — Minification (programming)
Reviewed Oct 17, 2026 · test vectors fixtures/dev/json-minify/