- Input
- Output
- Change
- Gzipped
- Keys
- Max depth
Minify or beautify JSON in your browser
Paste JSON or open a file and the output updates as you type. Minify strips every space and line break that isn't inside a string, producing the smallest valid JSON. Beautify does the opposite, indenting each level so the structure is easy to read. Both check the JSON first, and if something's wrong, you get the exact line and column, a view of the problem spot, and a plain-English explanation of how to fix it.
Your data stays on your device. Nothing is uploaded, which matters when the JSON holds API keys, customer records, or internal config.
What makes this minifier different
Most online JSON minifiers run your text through JSON.parse and JSON.stringify. That's quick, but it quietly changes your data in three ways. This tool works on the original text instead, so what goes in is what comes out, minus the whitespace:
- Large numbers stay exact. An ID like
12345678901234567890becomes12345678901234567000after a round trip through JavaScript. Here it's kept digit for digit, and the tool tells you when a file has numbers that other JavaScript tools would round. - Duplicate keys aren't silently dropped.
JSON.parsekeeps only the last copy of a repeated key. This tool keeps both and warns you, with line numbers, so you can decide. - Numbers keep their format.
1.50stays1.50and1e3stays1e3, rather than being rewritten.
How much does minifying JSON save?
On a typical pretty-printed API response, minifying removes 15 to 40 percent of the file size, most of it indentation. The bigger and more deeply nested the file, the bigger the saving. If your server already gzips responses, the real-world difference shrinks a lot, because compression handles repeated spaces very efficiently. That's why the stats above show gzipped sizes too, when your browser supports it. Minifying still helps for JSON stored in databases, localStorage, config bundles, and anywhere it's saved uncompressed.
Common JSON errors and how to fix them
| Problem | Invalid | Valid |
|---|---|---|
| Trailing comma | [1, 2, 3,] | [1, 2, 3] |
| Single quotes | {'name': 'Ann'} | {"name": "Ann"} |
| Unquoted key | {name: "Ann"} | {"name": "Ann"} |
| Comments | {"a": 1 // note} | {"a": 1} |
| Missing comma | {"a": 1 "b": 2} | {"a": 1, "b": 2} |
| Python values | {"ok": True, "x": None} | {"ok": true, "x": null} |
| Unescaped backslash | "C:\Users\ann" | "C:\\Users\\ann" |
| Special numbers | NaN, Infinity, 0x1F, 007 | null, a string, or 31, 7 |
Turn on "Repair loose JSON" and the first four, plus Python-style values, are fixed automatically. The tool lists what it changed. Special numbers and unescaped backslashes are left for you, because there's no safe way to guess what they should be.
Working with JSON Lines
Log files, data exports, and machine learning datasets often use JSON Lines (.jsonl or .ndjson): one complete JSON value per line, with no surrounding array. Regular JSON validators reject these files because they see more than one value. Tick "JSON Lines" and each value is validated separately, then written one per line when minified.
Frequently asked questions
Is minified JSON still valid JSON?
Yes. Whitespace between values has no meaning in JSON, so removing it doesn't change the data. Any JSON parser reads minified and beautified versions of a file identically. Spaces inside strings are never touched.
Can minifying break my JSON?
Not with this tool. The input is fully validated before any output is written, and only whitespace outside strings is removed. If you turn on sorting, repair, or escaping, those change the text on purpose and are listed in the notes.
How big a file can I minify?
Files up to 50 MB work in most desktop browsers. Files over 3 MB are processed without loading them into the text box, which keeps the page responsive; the output preview is shortened, but Copy and Download include everything.
Should I sort keys?
Sorting doesn't change what the JSON means, since object key order isn't significant in JSON. It makes files easier to compare and produces cleaner diffs in Git. Leave it off if a program depends on the original order, which some do despite the spec.
What does "Escape non-ASCII" do?
It writes characters like é, ü, 中, and emoji as \u00e9-style escape codes. The data is identical, but the file becomes pure ASCII, which avoids encoding problems with older systems. It makes the file larger, so leave it off unless you need it.
Why does the tool say my JSON has invisible characters?
Text copied from web pages, chat apps, or word processors can carry non-breaking spaces and zero-width characters. They look like normal spaces but aren't allowed between JSON values. Repair mode removes them; otherwise, retype the spaces around the reported position.

