JSON Minifier
minify JSON by removing whitespace to reduce size
By Bikram NathLast updated
Strips all whitespace characters (spaces, tabs, and newlines) from JSON to produce the smallest valid representation of the data. Paste a formatted API response like { "id": 1, "name": "Alice" } and get {"id":1,"name":"Alice"} back. Unlike a formatter that also validates structure, this tool focuses purely on compaction without reordering keys or re-encoding numeric values.
Try it now — free, instant, no signup
What is JSON Minifier?
JSON Minifier takes a JSON document and removes every whitespace character that is not inside a string value. A 4KB pretty-printed config file with two-space indentation typically compresses to under 1KB after minification, leaving just key-value pairs with no padding. The output is semantically identical to the input; any JSON parser sees the same data structure either way.
Reach for this when you need a quick result without installing anything. If you are already in a terminal, jq -c '.' does the same thing and handles arbitrarily large files. Python's json module needs json.dumps(data, separators=(',', ':')) for true minification since the default format includes a space after each colon. Where this tool wins is speed of access: no shell, no module import, no flags to remember, making it useful mid-debugging when you need to paste a compact payload into a curl command or a test fixture.
One gotcha: whitespace inside string values is never touched. If your JSON contains "address": "123 Main St " with trailing spaces inside the value, those spaces survive minification intact. This is correct behavior per spec, but it surprises people expecting a broadly clean output. Separately, if your source includes C-style // or /* */ comments, which are a JSON5 extension and not valid ECMA-404, the parser will reject the entire document before minification begins.