Pretty-print or minify JSON with your choice of indentation and optional key sorting.
JSON Minifier
Shrink JSON to a single line without touching your values — and turn JSON with comments or trailing commas into strict JSON. See exactly how many bytes you save.
Minified locally in your browser — your JSON is never uploaded
How it works
- If enabled,
//and/* */comments outside strings are removed, along with commas directly before}or]. They’re replaced with spaces, so error line numbers still match your input. - The result is checked as strict JSON (RFC 8259). Errors show the line, column and reason, and “Show error” highlights the spot.
- Whitespace outside strings is removed. Strings and numbers are copied character for character, never re-serialised.
- Sizes are UTF-8 bytes. The gzip figure is calculated locally with the browser’s
CompressionStream.
Example
The sample config with a comment and two trailing commas minifies to:
{"currency":"ZAR","items":[{"name":"Boerewors roll","price":45.50},{"name":"Chakalaka","price":25.00}],"updated":1767225600} Note that 45.50 and 25.00 keep their trailing zeros. JSON.stringify would have written 45.5 and 25. Untick “Remove comments” and you get the precise error: line 2, column 3, with the reason.
Frequently asked questions
How is this different from JSON.stringify?
Re-serialising with JSON.parse + JSON.stringify can silently change your data: 1.50 becomes 1.5, 1e3 becomes 1000, and integers above 2^53 lose precision. This minifier only removes whitespace (and, if you ask, comments and trailing commas), copying every string and number exactly as written.
Can it minify JSON with comments?
Yes. Tick “Remove comments” and “Remove trailing commas” to turn JSONC-style files (tsconfig.json, VS Code settings) into strict JSON. Comments inside strings are left alone.
What is the gzip size?
How big the minified JSON would be if your server compresses it with gzip, calculated in your browser with the built-in CompressionStream. It shows how much minifying really saves over the network — often less than the raw size suggests, because gzip already compresses whitespace well.
Is my JSON uploaded?
No. Everything runs in your browser, which matters if your JSON contains API keys, tokens or customer data.
Related tools
Validate JSON and pinpoint errors by line and column — including duplicate keys that most parsers ignore.
Encode text (UTF-8) or any file to Base64, URL-safe Base64 or a data URI, with optional MIME wrapping.
Generate random v4 or time-ordered v7 UUIDs in bulk, in the format you need.
Related guides
JSON, Base64, URL encoding and HTML entities explained
What JSON, Base64, percent-encoding, HTML entities, UUIDs and Unix timestamps are for — and the common mistakes developers make with each.
CSS colour formats explained: HEX, RGB, HSL, HWB and OKLCH
What each CSS colour format means, when to use it, why OKLCH is useful for palettes, and how to check colour contrast for accessibility.
JWTs explained: structure, claims, decoding vs verifying, and common mistakes
How JSON Web Tokens work, what each part and claim means, why decoding isn't verifying, and the mistakes that cause real security bugs.