JSON Minify & Compress
Strip whitespace and comments from JSON in one click, then compare input vs output size and compression ratio. Ideal for URLs and shrinking API payloads.
How it works
- The minifier parses your JSON with strict
JSON.parse, which naturally strips every comment, trailing comma, and inconsistent indentation — then re-serializes with zero whitespace. - If your input is not valid JSON (trailing commas, JavaScript object literals), the tool tries a lenient fallback parser that accepts common browser-style JSON.
- Statistics show the input size, compressed size, savings percentage, and an estimated gzipped output — useful when comparing payload sizes for API responses.
About Minifying JSON
Minifying JSON removes all spaces, tabs, and newlines between tokens. For typical real-world payloads this saves 30–60% of the byte size, which matters when embedding JSON in URL query strings (where there is a 2048-character soft limit), HTML data attributes, CSS --var declarations, email templates, or any bandwidth-sensitive transport. The output is byte-identical to the input for the parser — any program that accepts the pretty version will accept the minified version.
What minification removes
Minification strips insignificant whitespace between tokens. It cannot change the contents of a string, so a value that contains meaningful spaces or newlines survives intact — only the whitespace between structural elements is removed.
The size comparison shown next to the result gives the actual saving. For a typical API response the reduction is 40–60%, which is the difference between a payload that fits comfortably in a header and one that does not.
When minifying is the wrong move
Do not minify a file you still need to read. Minified JSON is functionally identical but hostile to diffs, to code review, and to manual debugging — a single changed character shows up as a whole-line change in version control.
If the goal is to shrink a response, minify at build or deploy time rather than editing the source. If the goal is to embed JSON in a URL, check whether the consumer expects URL encoding as well.
Next steps
- JSON Statistics— see the compression ratio
- JSON Formatter— re-format when needed
Frequently Asked Questions
How do I minify JSON to a single line?
Does minifying change my JSON data?
Is my data sent to a server?
Do I need an account or API key?
Can I use these tools offline?
All processing happens in your browser. No uploads, no tracking, no servers. Your API keys, configs, and private payloads stay private — 100% client-side.