JSON minifier
Strip every unnecessary byte from a JSON payload and see exactly what you saved. Parsed first, so the output can never be broken.
Guide
How to use it
- Paste formatted JSON.
- The minified version and the before/after byte counts appear instantly.
- Copy the output or download it as data.min.json.
- Going the other way? The formatter re-expands any minified blob.
Examples
Worked examples
Four-space indented test data drops to 34 KB, a 29% saving, worth it for a payload bundled into an app.
JSON stuffed into an environment variable or a data attribute has to be one line anyway. Minify it here rather than hand-deleting line breaks and missing one.
A response served with gzip shrinks whitespace almost for free. Minify for storage quotas, embedded strings and pre-compression budgets, not as a reflex.
Method
How it works
The text is parsed with the browser's native JSON parser and re-serialised with no whitespace argument, which is the safest possible minification: invalid input is refused with the exact error rather than mangled, and valid input comes out byte-exact in meaning. Byte counts use the UTF-8 encoded size, the number that matters on the wire.
Runs entirely in your browser; payloads are never uploaded.
FAQ
Frequently asked questions
How much does minifying JSON save?
Typically 10 to 30 per cent of the raw bytes, depending on indentation depth. After gzip or brotli compression the gap shrinks a lot, whitespace compresses extremely well.
Is minified JSON still valid?
Yes, completely. Whitespace between tokens carries no meaning in JSON, so removing it changes nothing about the data. This tool parses and re-serialises, so the output is valid by construction.
Should I minify config files?
Usually not. Configs are read by humans and diffed in version control, where one long line is painful. Minify what machines exchange, format what people maintain.
Does it remove keys with null values?
No. Minifying only removes whitespace. Dropping nulls or empty fields changes the data's meaning, which a formatter has no business doing.
Why did my invalid JSON not minify?
The minifier parses first, which is a feature: it refuses to emit broken output. Fix the reported error (the validator explains it), then it minifies.
Is my payload uploaded anywhere?
No. Parsing and re-serialising happen in your browser and the text never leaves your device.
More tools