Contact

Tools  /  JSON  /  JSON Minifier

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.876543219 carries 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?
No. Parsing, repair and minification all run locally in the browser — nothing is sent to a server.
Does minifying lose any data?
Plain whitespace removal is lossless: the structure, keys and values are all identical, only the formatting is gone. Stripping nulls, stripping empty containers, and rounding numbers do change the data and are separate, opt-in options for exactly that reason.
What do "strip nulls" and "strip empty containers" actually remove?
Strip nulls removes any key whose value is 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.
Is the gzip estimate the exact size after real gzip compression?
No, and it is labeled as an estimate for that reason. It is a fast approximation based on repeated patterns in the text, meant to give a rough sense of scale before compressing for real, not an exact figure to rely on.
What is the Base64 or JS string literal output for?
Both are for putting JSON somewhere that plain JSON syntax does not fit cleanly. The JS string literal option re-escapes and quotes the result so it can sit as a string value inside another JSON document or source file; Base64 suits places like a URL parameter or an environment variable.
Can it fix broken JSON before minifying?
Yes — a comment left in by mistake, a trailing comma, or single quotes instead of double are repaired automatically the moment strict parsing fails, and the same repair is also available as its own button.
Theme Accent