Minification removes whitespace only. The data itself is never altered.
Minifying strips every byte of whitespace that sits between tokens, and leaves everything else exactly as it was. The tool reports the saving as both a byte count and a percentage, so you can decide whether the trade in readability is worth it before you commit the change.
It also works in the other direction. Switch Output to Formatted and the same box pretty-prints instead, which is useful when you have a minified line of production data and need to see what is inside it.
How to use this tool
- Paste the JSON you want to shrink into the top box. Indented, pretty-printed input gives the largest saving; already-minified input gives almost none.
- Click Minify. The result appears in the lower box, and the metric strip above shows the original size, the minified size and the reduction.
- Switch Output to Formatted (indent 2) when you need the readable version back. This is a single toggle rather than a separate tool.
- Click Copy result to take the output. If the input does not parse, the error appears instead of a result, so you cannot accidentally copy corrupted output.
What minification removes, precisely
The operation is narrower than the name suggests, and being precise about it prevents a common misunderstanding. Minifying removes whitespace that appears between structural tokens: spaces after colons, spaces after commas, and line breaks and indentation between members.
It does not touch:
- Whitespace inside string values. In a value such as
"Ada Lovelace"the space between the two words is data and survives intact. So does a string that is nothing but spaces. - Key order. The document is parsed and re-serialised, and the serialiser preserves insertion order, so nothing is alphabetised.
- Numeric values.
12.50stays12.50rather than becoming12.5, because the parser retains the value and the serialiser writes it back consistently. - Escaped sequences.
\ninside a string remains a two-character escape rather than being turned into a real newline. - Duplicate keys. They are not collapsed, though note that most parsers keep only the last occurrence when reading.
Because a parser sits in the middle of the operation, malformed input fails before any transformation happens. There is no path where you get a silently corrupted result.
How much you actually save, and when it is worth it
Saving depends entirely on how much whitespace was present to begin with. Realistic figures:
- Deeply nested config with two-space indent — commonly 30 to 50 per cent. Every nesting level multiplies the leading whitespace, so deep structures save the most.
- Shallow API responses — typically 10 to 20 per cent. Less indentation depth means fewer bytes to remove.
- Already-compact JSON — close to zero. There is nothing left to take out, and the tool will report a saving in the low single digits at most.
Now the caveat that matters more than any of those numbers. If your JSON travels over HTTPS with gzip or Brotli enabled, minifying before sending saves very little. Both compression algorithms are extremely good at exactly this problem: they encode repeated runs of spaces and newlines as a single reference, so an indented document and a minified one arrive at nearly the same compressed size. Minify a pretty-printed payload and watch the transfer size in a browser network panel with and without the change — the difference is usually under a few per cent.
Where minification is genuinely worth doing:
- Data written to disk or baked into a build. The saving is paid once and kept forever, with no compression layer to hide it.
- Payloads sent without content encoding. Some internal services, message queues and IoT protocols skip HTTP compression entirely, and then the difference is the full 30 to 50 per cent.
- Storage-limited environments. Browser localStorage, mobile app preferences and embedded device flash all have hard ceilings where every kilobyte counts.
- Log output and line-delimited formats, where a record must fit on exactly one line.
Minify with a reason, in other words. Treating it as automatic good practice adds an unreadable artefact to your repository in exchange for a saving that gzip was already delivering.
The precision limit you should know about
JSON numbers have no type distinction between integers and floats, and the parser that handles them is the one built into your browser. That parser follows IEEE-754 double precision, which represents integers exactly only up to 2^53 — that is 9,007,199,254,740,992.
Beyond that the limitation bites. Twitter exposed this for years: post identifiers exceeded 2^53, and JavaScript clients that parsed them as numbers silently lost the low digits, so two distinct posts could appear to have the same ID. The fix was to serialise them as strings.
This is a property of JSON parsing in JavaScript rather than of minification specifically, and formatting has the same exposure. If your document contains identifiers, timestamps in nanoseconds, or financial values with more than fifteen significant digits, the safe pattern is to quote them as strings in the payload. Sometimes the value is already a string and code elsewhere is calling parseInt on it, which reintroduces the same problem.
Minification will not make this worse — the round trip through a parser is identical either way — but it will not warn you about it either, because the parser cannot tell that a large number was meant to be an identifier.
Minified JSON in practice: where you meet it
Minified documents are the default in most places JSON appears, which is why being able to expand one quickly is as useful as the ability to shrink it.
- HTTP API responses. Virtually every production API returns minified JSON, because the cost of pretty-printing is paid by every client on every request. Copying a response into this tool is the fastest way to read it.
- Build artefacts. Bundlers, source maps and manifest files are minified as a matter of course.
- Package manifests. A published
package-lock.jsonis often minified, making a dependency conflict hard to trace until you expand it. - Embedded configuration. Docker labels, Kubernetes annotations and environment variables frequently hold a single-line JSON blob.
- Database columns. PostgreSQL
jsonb, SQLite TEXT columns and document stores return minified output by default.
For reading rather than shrinking, the JSON Viewer is usually the better entry point, because a collapsible tree is far easier to navigate than a long flat block of indented text. Minify when you need the smaller artefact; view when you need to understand what is in it.
Is minifying worth it in your case?
| How the JSON is used | Compressed in transit? | Worth minifying |
|---|---|---|
| HTTP API response | Usually yes (gzip or Brotli) | Marginally — low single digits |
| File written to disk or committed | No | Yes — the full saving persists |
| Internal service without content encoding | No | Yes — commonly 30 to 50 per cent |
| Browser localStorage or app settings | No | Yes — quota is measured uncompressed |
| Log line or streaming record | Varies | Yes — one record must fit one line |
| Payload you have to read and edit by hand | Not relevant | No — keep it formatted |