JSON minify: the same data in fewer bytes
To JSON minify a document means to delete the whitespace that only exists for human readers: indentation, line breaks and the spaces after colons and commas. Parsers ignore that whitespace, so the minified text describes exactly the same data while taking less room on disk and on the wire.
Whitespace inside string values is part of the data and is never touched. A value like "keep these spaces" comes out with all three spaces between each word.
Before and after
{
"name": "Ada Lovelace",
"note": "keep these spaces",
"tags": [ "math", "poetry" ],
"born": 1815
}
After Minify:
{"name":"Ada Lovelace","note":"keep these spaces","tags":["math","poetry"],"born":1815}
The status bar reports 111 B → 91 B (18% smaller). Sizes are measured in UTF-8 bytes, so accented letters and emoji count as the two to four bytes they really occupy, and anything above 1,024 bytes is shown in KB.
How much can you save?
It depends on how deeply the data is nested and how it was indented. The tool's own sample, a small company record indented with two spaces, drops from 690 to 448 bytes, a 35% saving. Documents indented with four spaces or tabs and many short values save more; documents made mostly of long text strings save less, because most of their bytes are inside strings.
Minify and gzip are different things
Most web servers compress responses with gzip or Brotli, and those algorithms are very good at squeezing repeated spaces. Measured with gzip at its default level, the same sample shrinks to 351 bytes when formatted and 309 bytes when minified. So on compressed HTTP traffic the gain from minifying is real but modest.
Minifying pays off more where no compression happens:
- JSON stored in database columns, key-value stores or
localStorage, where every byte counts against a quota. - Values placed in environment variables, HTTP headers, query strings or command-line arguments, which must fit on one line.
- Fixtures and payloads embedded in HTML, JavaScript bundles or message queues.
- Log lines, where one record per line keeps tools like
grepuseful.
If you need actual compression, the Gzip compress tool produces gzip output as Base64 or hex.
Things minifying also does
The input is parsed before it is written back out, which has a few side effects worth knowing. Invalid JSON is rejected with a line and column instead of being half-compressed. Numbers are rewritten in their shortest form, so 1.0 becomes 1 and 2.5E-3 becomes 0.0025. If a key appears twice in one object, only the last value remains. Key order and array order are otherwise preserved exactly.
Minify vs one line
Minified output has no spaces at all. When you want a single line that is still easy to scan, for example in a log message or a code review comment, the JSON to one line tool can keep one space after each colon and comma. To place minified JSON inside a string in code or another JSON document, escape it with JSON stringify.
Privacy
Minification runs locally in your browser; the JSON you paste is not transmitted. The server is involved only if you use Load URL (the file is fetched through it) or Save & Share (the input is stored so the link works).
JSON minify in Python
Parse the text with json.loads() and write it back with json.dumps(). The catch is that json.dumps() on its own does not minify: by default it puts a space after every comma and colon, so you have to pass separators=(",", ":"). It also escapes each non-ASCII character as \uXXXX, which makes the output longer; add ensure_ascii=False to keep characters such as ë as written, and save the result as UTF-8.
import json
pretty = """{
"name": "Zoë",
"tags": ["a", "b"],
"active": true,
"manager": null
}"""
data = json.loads(pretty)
print(json.dumps(data))
# {"name": "Zoë", "tags": ["a", "b"], "active": true, "manager": null}
minified = json.dumps(data, separators=(",", ":"), ensure_ascii=False)
print(minified)
# {"name":"Zoë","tags":["a","b"],"active":true,"manager":null}
print(len(pretty.encode("utf-8")), "->", len(minified.encode("utf-8")), "bytes")
The second line of output is exactly what the Minify button above returns for the same document, so this page works as a quick check on a script.