JSON Minifier
Strip whitespace from JSON down to the smallest valid form -- with comment/trailing-comma repair, optional null/empty stripping, number rounding, size stats and gzip estimate.
What this tool does
Paste or load JSON and it comes back with every unnecessary space, line break and indent removed — the smallest valid form of the same data. If the input has a stray comment, a trailing comma, or single quotes instead of double, it is repaired automatically before minifying rather than just failing.
Shrinking the data itself, not only the whitespace
Whitespace removal alone is lossless and always safe. Beyond that, four optional passes can shrink the actual payload:
- Strip nulls — removes every key whose value
is
null, recursively through the whole structure. - Strip empty containers — removes any
{}or[]left behind, including ones that only became empty after nulls were stripped out of them. - Round numbers — rounds every non-integer to
a chosen number of decimal places, useful when a value like
9.876543219carries more precision than anything downstream will use. - Sort keys — orders every object's keys alphabetically, which can improve compression further since similar payloads then share more identical byte sequences.
These four are opt-in and change the data, unlike plain whitespace removal — turn on only the ones that make sense for where the output is going.
Getting the output into the right shape
The minified result can come out three ways: as raw JSON, as a JS string literal (the whole thing re-escaped and quoted, for pasting JSON as a string value inside another JSON document or a source file), or as Base64, for contexts like a URL parameter or an environment variable where raw JSON syntax would not survive intact.
Knowing how much you saved
Original size, minified size, and the exact bytes and percentage saved are shown for every run, alongside an approximate gzip size. That gzip figure is a fast entropy estimate, not a real gzip pass — useful for a sense of scale before shipping compressed JSON over the network, not as an exact number to quote.
Privacy
Parsing, repair and minification all happen in your browser. Nothing you paste, drop, or load from a file is sent to a server.
Frequently asked questions
Is my data uploaded anywhere?
Does minifying lose any data?
What do "strip nulls" and "strip empty containers" actually remove?
null, at every level of nesting. Strip empty containers then removes any {} or [] left over, including ones that were only emptied out by the null-stripping step.