Skip to content

JSON Minifier - Compress JSON Online

Input JSON
Minified Output

Minify or Beautify JSON

Paste JSON, or click "Load sample", and the minified version appears with the byte count before and after. Switch to "Beautify" to go the other way and get 2-space indented output. Turn on "Strip comments" if your input is JSONC, such as a tsconfig.json or a VS Code settings file. Invalid JSON shows the parser error instead of producing broken output. Nothing is uploaded.

Before and After

This formatted input is 98 bytes:

{
  "id": 42,
  "name": "Widget",
  "tags": [
    "tools",
    "hardware"
  ],
  "inStock": true
}

Minified, it is 68 bytes, about 30% smaller, and parses to exactly the same data:

{"id":42,"name":"Widget","tags":["tools","hardware"],"inStock":true}

Large integers such as Discord or Twitter snowflake IDs are copied as written, not rounded, so the output is safe to send back to the API it came from.

When Minifying Matters

If your server already compresses responses with gzip or Brotli, the gain is smaller than the raw numbers suggest. Repeated indentation compresses very well, so a file that shrinks 30% when minified may only shrink 5% to 10% once both versions are gzipped. Minifying matters more where compression is not applied: environment variables, URL parameters, browser storage, message queues with size limits, JSON embedded in HTML, and one-line-per-record formats like JSON Lines.

For files people read and edit, such as config files in a repository, keep the formatted version. Readable diffs are worth more than a few bytes. To pretty-print with a different indent width, use the JSON formatter.

Related Tools

Frequently Asked Questions

Does minification change my data?
No. Only whitespace between tokens is removed. Keys, values, key order and number spelling stay exactly as they were, and any JSON parser reads the minified and formatted versions as the same data. Whitespace inside strings is kept.
How much smaller will my JSON get?
It depends on the indentation. Pretty-printed JSON with 2-space indents usually shrinks by 10% to 30%; deeply nested data with 4-space indents can lose 40% or more. The tool shows the byte counts before and after.
Will minifying change large numbers like 64-bit IDs?
Not here. Many minifiers parse JSON into JavaScript numbers and print it back, which rounds integers above 9,007,199,254,740,991. An ID like 12345678901234567890 comes out as 12345678901234567000. This tool removes whitespace from the original text instead, so every number, including spellings like 1.0 and 1e5, is copied exactly.
Can I minify JSON that has comments?
Yes. Turn on "Strip comments (JSONC)" to remove // line comments, /* block */ comments and trailing commas, as found in tsconfig.json or VS Code settings. Comment-like text inside strings, such as URLs, is left alone.
Should I minify JSON before storing it in a database?
Usually it makes no difference. PostgreSQL's jsonb and MongoDB store a parsed binary form, so whitespace is discarded anyway. A plain text or json column stores exactly what you send, so minifying there does save space, and it keeps each value on one line in exports and logs.