JSON Minify

Free JSON minifier: paste a pretty-printed JSON document and compress it to a single compact line by removing all non-essential whitespace. Validates first, runs in your browser.

Paste JSON above, then press Minify JSON.

How json minify works

This tool takes a pretty-printed or whitespace-heavy JSON document and returns the smallest possible equivalent JSON by removing every space, tab, and newline that is not inside a string. The output is a single compact line that parses to exactly the same value.

Paste your JSON and the tool first parses it to confirm it is valid. If parsing fails, it reports the error and produces no output. If parsing succeeds, it serializes the parsed value back out with JSON.stringify and no indentation, which drops all non-essential whitespace.

Minifying JSON reduces file size, which speeds up network transfer and storage. The transformation is exactly the inverse of the JSON Formatter, which expands compact JSON into a readable, indented view.

Frequently asked questions

How is this different from the JSON Formatter?
The JSON Formatter pretty-prints compact JSON into a readable, indented view. This tool does the opposite: it takes pretty-printed or whitespace-heavy JSON and compresses it to the smallest single-line form.
Does minifying change the data?
No. The tool parses your JSON into a value and serializes it back out, so the minified output parses to exactly the same value. Only non-essential whitespace between tokens is removed; whitespace inside string values is preserved.
What happens if my JSON is invalid?
If the input does not parse as valid JSON, the tool reports the parser error and produces no output, so you can fix the syntax before minifying. It never silently emit broken JSON.
Why minify JSON?
Minified JSON is smaller, so it transfers faster over the network and takes less storage. It is the standard form served by APIs and used inside bundled config files.