JSON Minifier
Free online json minifier for developers. Compact JSON by removing whitespace. Fast and private.
Embed this tool
Copy and paste the code below into your website to embed this tool for free. An attribution link to The Util Box is required.
<iframe src="https://www.theutilbox.org/embed/json-minifier" width="600" height="500" frameborder="0" style="border: none; max-width: 100%;" title="Free JSON Minifier tool from The Util Box"></iframe> <!-- Free tool by The Util Box — https://www.theutilbox.org/tools/json-minifier --> <a href="https://www.theutilbox.org/tools/json-minifier">JSON Minifier by The Util Box</a>
Frequently Asked Questions about JSON Minifier
JSON Minifier — Strip Whitespace and See the Real Payload Size
This JSON minifier parses your JSON and re-serialises it with every optional space, tab and newline removed, then reports exactly how many bytes you saved as a percentage. Minified JSON is functionally identical to the pretty version — it is the same data with the formatting discarded — but it is meaningfully smaller, which matters when you are serving it over the network, storing it, or fitting it into a fixed field.
All processing is local, via the browser's own
JSON.parse and JSON.stringify, so it works
offline and never transmits the payload.
This Tool Also Validates — That Is Half the Value
Minification happens by fully parsing the input, so invalid JSON cannot be minified. If the result panel turns red and shows a message instead of output, the JSON is malformed. That makes this a fast validator as well as a size reducer, and the errors are the same precise native messages described in the JSON Formatter — unexpected token, unexpected end of input, and so on.
The size readout is the other thing worth using. It shows the original byte length, the minified byte length, and the reduction percentage side by side, which tells you immediately whether a payload is bloated by formatting or genuinely large.
How Much You Actually Save
Savings depend entirely on how the source was formatted. Indentation is what costs bytes, so a file that was written with two-space indentation and newlines will shrink dramatically, while a file that is already compact will barely move:
| Source format | Typical saving | Why |
|---|---|---|
| 2-space indented, one key per line | 40–60% | Indentation and newlines dominate small objects. |
| 4-space indented | 50–70% | Deeper indentation means more whitespace to remove. |
| Single line, one space after colons | 5–15% | Only the separator spaces remain to remove. |
| Already minified | 0% | Nothing left to strip — a good sanity check. |
A useful rule of thumb: for a large object with many short keys, whitespace is often 30% or more of the total. On a 500 KB API response that is real latency and real money.
Two Things to Watch
- Whitespace inside strings is preserved. Minification only removes formatting
between tokens. A string value of
"hello world"keeps its space, and a value containing meaningful newlines such as a certificate or a template is untouched. That is correct behaviour, not a bug. - Key order is preserved. The output follows your input order exactly. Keys are not sorted, which also means minifying is a safe, lossless round trip.
One genuine caveat: because the tool parses into a native JavaScript value and re-serialises, an integer larger than 253−1 loses precision in the browser. This affects astronomically large IDs and 64-bit database keys, not ordinary data. The same limitation applies to any browser-based JSON tool.
Related JSON Tools
- JSON Formatter — the inverse, and the right choice when you need to read the data rather than shrink it.
- JSON Diff — compare two payloads and see only the paths that differ.
- JSON Path Tester — pull a single value out without writing a parser.
- JSON Schema Validator — catch the type errors a formatter cannot.
- Base64 Encoder — for binary-ish payloads, though note base64 adds roughly 33% overhead, the opposite of minification.
- Code Minifier — the same idea applied to JavaScript, CSS and HTML.