How to use JSON Minifier
- Paste the formatted JSON.
- The compact version appears immediately together with the savings.
- Copy it or download minified.json.
JSON Minifier features
- Removes every insignificant whitespace character
- Shows original size, minified size and percentage saved
- Validates the input and reports syntax errors with line and column
- Live minification with copy and download
JSON Minifier example
Compact a configuration file
Input:
{
"service": "inventory",
"replicas": 3,
"ports": [8080, 8443]
}Output:
{"service":"inventory","replicas":3,"ports":[8080,8443]}Frequently asked questions about JSON Minifier
Does minifying change the data?
No. Only insignificant whitespace outside of strings is removed. Values, key order and string contents stay exactly the same.
How much space will I save?
Typically 20–40% for indented documents. The tool shows the original size, the minified size and the percentage saved.
Is minified JSON still valid?
Yes. Whitespace is optional in JSON, so the compact output is fully standards-compliant and parses with every library.
Can I minify JSON that has comments?
Comments are not part of JSON, so the parser rejects them. Remove the comments (or use a JSON5-aware tool) before minifying.
Technical notes
Minification is a re-serialisation rather than a whitespace stripper: the text is parsed with JSON.parse and written back with JSON.stringify. The decoded data is identical, but the bytes can differ from the source — \u00e9 and \/ escapes become literal characters, 1.0 becomes 1, 1E2 becomes 100, -0 becomes 0, duplicate keys keep only their last value, and integers beyond 2^53 − 1 are rounded before being written out.
Sizes are measured in UTF-8 bytes by a small hand-written counter (1–4 bytes per code point), while the 'chars' hint shows the UTF-16 length that JavaScript's .length reports; the two diverge for accented, Arabic or emoji text. The percentage is rounded to one decimal place, a note appears when the output is not smaller than the input, and the runtime refuses any field larger than 2 MB before the engine runs.