JSON Minifier

Max 512 KB · Minifies automatically as you type

Processed entirely in your browser — nothing is sent to a server.

What is a JSON minifier?

JSON’s whitespace — the newlines and indentation that make a nested object readable — carries no meaning to anything that parses it. A JSON minifier strips all of that non-significant whitespace out, collapsing a formatted document down to the smallest valid representation of the exact same data: same keys, same values, same structure, just none of the characters that existed purely for a human reader. It’s the direct complement to a JSON formatter, which does the opposite — re-indenting minified JSON into a readable form. The two operations are fully reversible: minifying loses nothing a formatter can’t restore, because neither one ever touches the actual data, only how it’s spaced out.

Why minify JSON

The main reason is size. A deeply nested config or API response can easily be 20-30% smaller minified than formatted, purely from removed whitespace — and that difference compounds anywhere JSON is transmitted or stored repeatedly: an API response served to thousands of clients, a config file fetched on every page load, or a bulk export written to disk. None of that whitespace helps a program read the file faster; it only helps a person editing it by hand. The common pattern is to keep a source file formatted (for version control diffs and code review) and minify it as a build or deploy step, so the readable version and the shipped version are different artifacts serving different audiences.

How it works

Paste JSON into the input field; the minified result appears on the right as you type, debounced slightly so it doesn’t reprocess on every keystroke. Parsing uses the browser’s built-in JSON.parse, exactly the same step the JSON Formatter uses — the only difference is what happens after a successful parse: this tool calls JSON.stringify with no indentation argument at all, producing the shortest valid serialization, while the formatter calls it with a 2-space indent for readability. Because both tools share that identical parse step, any input that’s valid on one is valid on the other, and the error messages you’ll see for broken input are the same too. If JSON.parse throws, the tool shows the error message along with the line and column where parsing failed, rather than a blank or partial output. Nothing here touches a server — the 512 KB input cap exists only so very large documents stay responsive to re-process on every keystroke in a browser tab, not because of any transmission limit.

Examples

Frequently asked questions

Is my JSON sent to a server?
No. Minifying runs entirely in your browser using JavaScript's built-in JSON.parse/JSON.stringify. No data leaves your device.
What's the maximum file size?
512 KB — the same limit as the JSON Formatter, since both tools parse the same kind of input at the same cost. For larger files, a code editor's built-in JSON support handles minifying locally without a size restriction.
Is minifying lossy? Can I get my formatted JSON back?
No data is lost. Minifying only removes whitespace that has no meaning in JSON — the keys, values, and structure are exactly preserved. Paste the minified output into the JSON Formatter to re-indent it back to a readable form at any time.
Why does it report an error on my JSON?
The input isn't valid JSON, so there's nothing safe to minify. Common causes: trailing commas, single-quoted strings, unquoted object keys, or comments (JSON doesn't allow comments) — the same parse step the JSON Formatter uses, so any input that formats correctly there will minify correctly here too, and vice versa.
Why would I minify JSON instead of just leaving it formatted?
Whitespace in a formatted JSON document is purely for human readability — a parser ignores it either way. Stripping it out reduces the payload a client has to download, a server has to store, or an API has to transmit, which matters most for large or frequently-requested JSON (a config file served on every page load, a bundled data file, an API response under bandwidth constraints). For anything a human needs to read or edit, keep it formatted instead.