Minify JSON
Compact, valid,
bytes saved.
Minify JSON to its smallest valid form or beautify it with 2 or 4 spaces. Validates as you type, shows the exact error position and the bytes saved. Runs entirely in your browser — your JSON never leaves your device.
What does minifying JSON do?
Same data, fewer bytes.
Minifying removes every character that JSON does not need: spaces, tabs, line breaks and indentation between tokens. The data is identical — a parser reads the minified and the formatted version exactly the same way — but the payload is typically 10–30% smaller, which matters for API responses, localStorage, cookies, message queues and configuration stored in a database. Beautifying does the opposite: it re-indents minified JSON so a human can read and review it.
Unlike regex-based minifiers, this tool parses the JSON first. Text inside strings is never touched, invalid JSON is reported with its line and column instead of being silently mangled, and integers longer than 15 digits (64-bit IDs) are written back exactly as they were.
Minify JSON in code
The same result in your own scripts.
// JavaScript / Node.js
const minified = JSON.stringify(JSON.parse(text));
# Python
import json
minified = json.dumps(json.loads(text), separators=(",", ":"), ensure_ascii=False)
# Command line (jq)
jq -c . input.json > output.min.json
When to minify and when to beautify
Minify for production
API responses, static JSON files served to browsers, data embedded in HTML and anything stored with a size limit (cookies, localStorage, URL parameters before Base64).
Beautify for people
Code review, debugging an API response, committing configuration to Git (diffs are readable) and documentation.
Related JSON tools
All utilities & encoding tools
