Skip to content

JSON minify

Strip all the whitespace from JSON to get the smallest valid document, and see exactly how many bytes you saved.

Going the other way

To make minified JSON readable again, use the JSON formatter. If it won’t parse, the JSON validator points to the exact character.

Questions people ask

What does minifying JSON do?

It removes every space, tab and line break that is not inside a string. The result is the same data in the fewest bytes, which is ideal for API payloads, config embedded in HTML, or localStorage.

How much smaller does JSON get?

Typically 10–40% for pretty-printed JSON, depending on how deep the nesting and how wide the indentation is. The panel shows the exact before and after size.

Is minified JSON still valid?

Yes. Whitespace between tokens is optional in JSON (RFC 8259, section 2), so minified and pretty-printed versions parse to exactly the same value.

Should I minify if my server uses gzip?

It still helps a little, but gzip or Brotli compression already removes most of the cost of repeated whitespace. Minify when you are storing or embedding JSON that won’t be compressed.