JSON Minifier
Remove every optional byte from a JSON document. The output is checked by the same parser that validates the input, and the before/after counts show exactly what was saved.
Runs entirely in your browser — your JSON is never uploaded.
Character counts are measured on the text exactly as entered. Byte counts are UTF-8 encoded sizes, which is what a network response or file on disk would use.
A worked example
Minification changes whitespace, not values. The byte counter shows what that is worth on your document.
Input
{
"id": 42,
"tags": ["a", "b"],
"ok": true
}Output
{"id":42,"tags":["a","b"],"ok":true}The output is semantically identical. For an HTTP response that is already gzip or brotli compressed, the wire saving may be small.
How to minify JSON
- Paste an indented document into the left panel, or press “Load example” for a verbose sample with nested objects.
- Press Minify JSON The document is parsed first, so invalid input fails loudly instead of producing a broken result.
- Read the comparison above the status line: characters before and after, characters saved, and the reduction percentage.
- Copy or download the compact output. The downloaded file is UTF-8 encoded JSON with a timestamped name.
What minification actually removes
JSON uses whitespace only as a separator between tokens. Everything else — the quotes around a key, the colon after it, the comma between members — is structural and has to stay. So a minifier removes:
- Indentation at the start of every line
- Line breaks between members and array items
- Spaces around colons and commas
- Trailing newlines at the end of the document
It does not remove or reorder anything inside a string, and it does not touch the keys themselves. Minified JSON is not compressed JSON — it is the same document with the formatting taken out.
When it is worth doing
- Request and response bodies that are measured in raw bytes, for example payloads stored in a database column or embedded in a log line.
- Bundled fixtures used by tests, where readability is provided by the formatter on demand rather than by the file itself.
- Inline JSON inside an HTML attribute or a script tag, where line breaks and indentation add bytes to every page view.
Minifying is usually the wrong choice for anything a human reviews: config files in a repository, example payloads in documentation, and anything that appears in a code review. A single-line diff of a minified file tells you nothing about what changed.
Characters, bytes and what the numbers mean
Character counts are taken from the text exactly as it appears in the editor. Byte counts are the UTF-8 encoded size, which is what a file on disk or a network response would contain. The two differ as soon as a document contains non-ASCII text: an accented letter or a CJK character takes two or three bytes even though it counts as one character.
That is why the summary reports both. A document full of non-ASCII strings can have a modest character reduction and a larger absolute byte reduction — or the other way round, if the indentation was mostly single spaces.
To go the other way, use the JSON formatter to pretty-print the result again, or the validator if you only want to know whether a document parses.
Minified versus compressed: the numbers
The percentage this tool reports is the reduction in raw characters. That is the number that matters on disk, but it is not the number that matters over HTTP, because responses are usually compressed before they are sent. To make the gap concrete, here is a 400-record order response measured six ways. Sizes come from Node 22's zlib at gzip level 9 and default brotli settings.
| Form | Size | Compared with |
|---|---|---|
| Indented, 2 spaces | 221,421 B | 216.2 KB — the baseline |
| Minified | 124,588 B | 43.7% smaller than the indented file |
| Indented, gzip -9 | 10,879 B | 10.6 KB |
| Minified, gzip -9 | 9,700 B | only 10.8% smaller than gzipping the indented file |
| Indented, brotli | 5,038 B | 4.9 KB |
| Minified, brotli | 4,791 B | only 4.9% smaller than brotli-compressing the indented file |
Read the last two rows together. Minifying removes 44% of the raw bytes, but only 5% of the bytes a browser downloads when brotli is on. Whitespace is exactly what a compressor is best at — a long run of identical spaces costs almost nothing once compressed — so the saving largely disappears into work the compressor was already doing.
- On disk, in a database column, in a log line, inside an HTML attribute — the raw figure applies in full. Nothing compresses those before you pay for them.
- Over HTTP with gzip or brotli enabled — expect a single-digit percentage. Still worth doing if the client also has to parse the body, but do not plan a latency improvement around it.
- In a commit, a code review or a git diff — minifying makes things worse. A single-line diff of a minified file tells every reviewer nothing about what actually changed.
There is one case where minifying is wrong even though the bytes do shrink: signed or hashed payloads. A JWS signature, a webhook HMAC, an ETag or a content-addressed identifier all cover the exact bytes of the document. Remove a single space and verification fails, with no hint about why. Serialize first, then sign.
The full breakdown, including how brotli compares with minification and how to check whether your own responses are compressed at all, is in the minify-versus-gzip guide.