Free · No sign-up · Private
JSON Minifier
Minify JSON by removing all whitespace for the smallest possible size.
Quick answer
Paste JSON and the minifier removes every space, tab and line break that is not inside a string, returning the smallest equivalent JSON and the number of bytes saved. Invalid JSON is reported instead of being minified.
{"a":1,"b":2}Step by step
How to use the JSON Minifier
01
Paste your JSON.
02
See the minified output and size saved.
Worked examples
Typical savings
| Input style | Typical size reduction |
|---|---|
| Formatted with 2 spaces | 15% to 30% |
| Formatted with 4 spaces or tabs | 20% to 40% |
| Already minified | 0% |
Good to know
When to minify
Minified JSON is smaller to store and send, which helps with configuration embedded in pages, API fixtures and local storage. For files people read or edit, keep them formatted and let the server compress them with gzip or Brotli instead.
Minify and compress
HTTP compression shrinks formatted JSON very well, so minifying adds only a small extra saving on the wire. Its main benefit is in places where compression is not applied.
What minification removes
Spaces, tabs and line breaks between keys, values, commas and brackets are removed. Whitespace inside strings is kept, because it is part of the data. Key order and number formats are preserved as JSON.parse reads them, so the minified result loads to exactly the same object as the original.
FAQ
Frequently asked questions
Is minified JSON still valid?
Yes. Whitespace between tokens is optional in JSON.
Can I undo minification?
Paste the result into the JSON formatter to pretty print it again.
More developer tools