JSON Minifier
Strip whitespace from JSON to produce the smallest valid output. Free, browser-only, no signup.
About JSON Minifier
The JSON minifier removes every byte of insignificant whitespace from a JSON document — line breaks, indentation, and the spaces JavaScript developers add around colons and commas — and emits the result as a single line. Because whitespace outside of string values is not semantically meaningful in JSON, the minified form represents exactly the same data as the original; only its size on the wire changes. Minified JSON is what APIs send, what CDNs cache, and what build tools embed.
When to use it
- Compressing JSON payloads before sending them over the network
- Inlining JSON config into a single-line environment variable
- Embedding JSON inside a single line of a shell script or YAML field
- Producing a canonical form for hashing or signing (combine with sort-keys)
- Reducing repository diff noise when checking generated JSON into git
How it works
The input is parsed with JSON.parse and re-emitted via JSON.stringify with no indent argument. The output preserves the original key order and contains no spaces outside of string values. As a side effect, the minifier validates the input — any syntax error is reported with a line and column number.
Examples
{
"name": "Ada",
"active": true,
"skills": ["math", "logic"]
}{"name":"Ada","active":true,"skills":["math","logic"]}[ 1, 2, 3, {"a": 1} ][1,2,3,{"a":1}]Frequently asked questions
- Does minifying change the data?
- No. JSON whitespace outside of string values is not significant, so the minified document parses to exactly the same value as the original.
- Is my JSON sent to a server?
- No. JSON.parse and JSON.stringify both run in your browser. Your input never leaves your device.
- How much smaller will it be?
- For a typical pretty-printed API response with 2-space indent, expect 20–40% size reduction. Heavily nested documents see more savings; flat arrays of numbers see less.
- Should I use this for production APIs?
- Real APIs already minify their JSON responses, and gzip/brotli compression at the HTTP layer further shrinks them. Manual minification is most useful for embedding JSON into other formats or producing canonical hashable forms.
- What about comments?
- Strict JSON doesn't allow comments, so the minifier will reject any input containing them. To handle JSONC, strip comments before minifying.