JSON Minifier
| What gets removed | What stays |
|---|---|
| Spaces between tokens | Strings (spaces inside quotes preserved) |
| Newlines between tokens | Numbers, booleans, null |
| Tabs and indentation | Object and array structure |
JSON minification removes all whitespace that is not inside string values - spaces between tokens, newlines, tabs and indentation. The result is a single-line JSON string that parses identically but is 30-50% smaller, which matters for API payloads, config files and data transfer.
The tool is careful about one thing: whitespace inside string values is always preserved. {"message": "hello world"} keeps the space in hello world - only the space between the colon and the opening brace is removed.
How to use
- Paste formatted JSON; the minified output appears instantly in the note below the result.
- Copy copies the full minified string; use the JSON formatter to go the other direction.
- The tool validates the JSON first - invalid input gets an error message, not a broken output.
Frequently asked questions
How much smaller does minification make JSON?
Typically 30-50% for indented JSON with 2-space indentation - the savings come from removing newlines, indentation spaces and spaces after colons and commas. Single-line JSON with no extra whitespace gains almost nothing because there is nothing to remove.
Does minification change the JSON data?
No - the RFC 8259 spec says whitespace between tokens is insignificant. JSON.parse produces identical objects from the minified and formatted versions. The only exception: whitespace inside string values is part of the data and is always preserved.
Should I minify JSON config files?
Only if they are machine-read exclusively. Human-edited config files should stay formatted - the whitespace is documentation. A common pattern: keep the formatted source in version control and minify at deploy time.
What is the difference between minify and compress?
Minification removes characters; compression (gzip, brotli) re-encodes the bytes. They stack: minify first to reduce the character count, then gzip the result. A minified JSON file compresses better than a formatted one because the reduced character variety makes patterns easier to find.