Advertisement

JSON Minifier

Minify JSON by removing all whitespace and line breaks. Shows the bytes saved, keeps numbers and strings exact, and can strip comments from JSONC.

Comments and trailing commas are removed from the output.

Minifying deletes every space, tab and line break that sits between JSON tokens, giving the smallest text that means exactly the same thing. Use it to shrink API payloads, fit JSON into a single line for an environment variable or a log, or store it compactly. The input is parsed strictly first, so broken JSON is reported rather than silently mangled, and the text inside strings is never touched.

How to use this tool

  1. Paste the formatted JSON.
  2. If it contains comments or trailing commas (JSONC), tick the option to strip them.
  3. Copy the single-line result and check the bytes saved in the note below it.

Formula

Saving (%) = (original bytes − minified bytes) ÷ original bytes × 100

Sizes are counted in UTF-8 bytes, the encoding JSON uses between systems (RFC 8259, section 8.1). Only whitespace outside strings is removed; keys, values, escape sequences and number spellings such as 1.50 are copied unchanged.

Example

The four-line input { / "a": 1, / "b": [ true, null ] / } is 35 bytes including its line breaks. Minified it becomes {"a":1,"b":[true,null]}, which is 23 bytes — 12 bytes or 34.3% smaller.

Frequently asked questions

Does minifying change the data?

No. Any JSON parser reads the minified and the formatted text as the same value. This tool also keeps big integers and number spellings exactly, which a JSON.parse round trip would not.

Is it worth it if my server already uses gzip?

Compression already squeezes runs of spaces, so the saving over the network is smaller than the byte count here. Minifying still helps wherever JSON is stored or sent uncompressed, such as database columns, environment variables, cookies and log lines.

How do I make it readable again?

Paste the result into the JSON Formatter, which adds the line breaks and indentation back.

Can it minify JSON with comments?

Yes. Tick Allow comments and trailing commas and both are removed, which also turns a JSONC file into standard JSON.

Sources

Last updated: 2026-10-30

Advertisement