JSON Minifier

Remove every unnecessary space and line break from a JSON document, entirely in your browser.

Runs entirely in your browser. Nothing is uploaded, logged or stored.

Minified JSON is what you want on the wire and in a config file that nobody reads by hand. Paste a formatted document and get the compact form back, with the number of bytes you saved.

How it works

The document is parsed and written back with no space between tokens. Only insignificant whitespace disappears: spaces and line breaks inside string values are part of the data and are preserved, escaped as the specification requires.

The saving reported is on the raw bytes. Over HTTP the real gain is usually smaller, because compression already handles repeated indentation very well.

Examples

Case Input Result
Whitespace removed { "id": 7, "tags": [ "a", "b" ] } {"id":7,"tags":["a","b"]}

Frequently asked questions

Is minified JSON faster to parse?

Marginally, and rarely in a way you can measure. The real benefit is transfer size, and even there gzip or brotli compression removes most of the difference before minifying does.

Does minifying change my data?

No value changes. The notation of numbers can be normalised and non-ASCII characters are emitted directly rather than as escape sequences, but the parsed result is identical.

Good to know

  • Everything happens in your browser. The document is not uploaded, not logged and not stored.
  • Integers larger than 2^53 lose precision, because JavaScript, which does the work here, reads every JSON number as a double precision float. Very large identifiers should be transported as strings.

Sources

All Code tools