JSON Minifier
Strip whitespace from a JSON file to shrink it.
Add a file
JSON, XML, text or any file you want to encode, decode or hash.
Choose an output
Strip whitespace from a JSON file to shrink it.
About JSON Minifier
The JSON minifier parses your file and re-serializes it with no spaces, tabs or line breaks between tokens. The result is a single line that is byte-for-byte smaller but means exactly the same thing to any JSON parser.
When it helps
- Shrinking a large fixture or seed file before embedding it in a bundle or test.
- Preparing a JSON body to paste into a curl command or an environment variable on one line.
- Reducing the size of static JSON served from a CDN, such as a search index or translation file.
Tips
- Whitespace inside string values is kept. Only the formatting between keys and values is removed.
- If your server already sends responses with gzip or Brotli, minifying saves less than you might expect, because compression handles repeated whitespace well.
- The file must be valid JSON. A trailing comma or a comment will stop the minifier with a parse error.
Good to know
Quick answers about json minifier in your browser.
Yes. JSON treats whitespace between tokens as insignificant, so the minified output parses to the same value as the original.
Run it through the JSON Formatter, which re-indents it with 2 spaces. Nothing is lost by minifying, so the round trip is exact.
Yes. There is no sign-up, no watermark and no limit on how many files you process.
No. Files are read and processed locally in your browser, so they never leave your device.
Related tools
Part of the Developer Tools collection.