JSON Minifier
Paste any JSON, get the smallest valid form back. Validates as it minifies — invalid input shows the parse error.
When minified JSON helps
- Inline data attributes.
data-config='{...}'in HTML — every byte counts. - localStorage / IndexedDB. Browser quotas are bytes; compact JSON fits more.
- postMessage / WebSocket payloads. Smaller payloads = faster handshakes, especially across slow links.
- QR codes. JSON in a QR code only fits if it's tiny — minify aggressively, and consider YAML if it's still too big.
- Inline SVG metadata, IPFS pins, blockchain calldata. Anywhere bytes are charged for.
When minified JSON hurts
- Logs. Minified is unreadable. Pretty-print logs in dev, minify only at the persistence boundary if needed.
- Diffs. A minified JSON change shows up as one giant line in
git diff. Pretty-print files that humans review. - HTTP responses with gzip / brotli. Compression nullifies most of the savings; the readability cost in DevTools is real.
How much it saves, by example
| Source | Indented | Minified | Savings |
|---|---|---|---|
| OpenAPI 3.0 spec | ~100 KB | ~70 KB | 30% |
| npm package.json (medium) | ~3 KB | ~2 KB | 33% |
| GeoJSON FeatureCollection | ~2 MB | ~1.4 MB | 30% |
| Deeply-nested config | variable | variable | 40-60% |
Minify + gzip is not double savings
A common misconception: minifying before gzip / brotli doesn't multiply. Compression algorithms recognize whitespace patterns and compress them efficiently. Minify-then-compress is typically only 2-5% smaller than indent-then-compress. The decision is about source-level size (where minification dominates), not transport size.
What this tool doesn't do
- It doesn't strip data — only whitespace. To remove keys, use a JSON-aware tool like jq.
- It doesn't validate against a schema. For that, you need JSON Schema tooling.
- It doesn't handle JSONC (JSON with comments). Strict JSON only.
Programmatic equivalent
// JavaScript / TypeScript
JSON.stringify(JSON.parse(input));
// Python
import json
json.dumps(json.loads(input), separators=(",", ":"))
// jq (CLI)
echo "$INPUT" | jq -c .
// Go
import "encoding/json"
out, _ := json.Marshal(parsed)
FAQ
How much space does minification save?
Typically 20–40% on indented JSON, more on heavily nested or whitespace-heavy files. The status line shows exact byte savings for your input.
Does minification change the data?
No. JSON.stringify(JSON.parse(input)) preserves every value, just removes whitespace. The output is byte-equivalent to the input as JSON values, just smaller.
Should I minify before HTTP transport?
If gzip / brotli are already on your response, the savings from minification are usually under 5% — gzip handles whitespace efficiently. The bigger win is for inline JSON (e.g. in HTML data-* attributes, postMessage payloads, localStorage) where compression isn't applied.
Is it the same as JSON Stringify with no indent?
Yes — JSON.stringify(value) with no second arg produces minified JSON. This page just exposes that with a textarea-friendly UX.