JSON Minifier

Compress JSON to a single line and see exactly how many bytes you save.

JSON Minifier

Compress JSON to a single line and see exactly how many bytes you save.

Paste pretty-printed JSON to shrink it to the smallest valid single-line form, with a live readout of original bytes, minified bytes, and percentage saved. Invalid JSON produces the parser's exact error message so you can fix it. Use the JSON Formatter when you want to read JSON; use this when you want to ship it.

How to use this calculator

  1. Paste pretty-printed JSON into the input box.
  2. Click Minify.
  3. Check the byte counts — original vs minified vs percentage saved.
  4. If the JSON is invalid, fix the flagged error and retry.
  5. Copy the single-line JSON into your request body, config, or code.

The formula

The input is parsed with JSON.parse and re-serialized with JSON.stringify (no spacing); both forms are UTF-8 encoded to count bytes, and savings are reported as (1 − minified ÷ original) × 100.

Worked example

Minifying a 52-byte pretty-printed object {"name": "Ada", "tags": ["a", "b"], "n": 42} produces the 38-byte single line {"name":"Ada","tags":["a","b"],"n":42} — a 26.9% saving, verified byte-for-byte in tests.

Frequently Asked Questions

How is this different from the JSON Formatter's minify mode?

The JSON Formatter is a general-purpose tool for reading and editing JSON — its minify mode is one option among several. This minifier is purpose-built for shrinking payloads: it validates, compresses, and reports precise byte counts and percentage saved, which is what you care about before sending data over the wire.

How are byte counts measured?

With UTF-8 encoding, which is how JSON is actually transmitted. A document with emoji or non-Latin characters counts their real multi-byte size, not just their character count — so the savings figure matches what you would see on the network.

Is minified JSON still valid?

Yes. Minification only removes insignificant whitespace outside of strings; the data is parsed and re-serialized, so the output is guaranteed valid JSON representing exactly the same value. String contents are never altered.

What happens with invalid JSON?

You get the JavaScript parser's exact error message, which usually points at the problem (a trailing comma, an unquoted key, a missing bracket). Fix the flagged spot and minify again.

Does my JSON leave the browser?

No — parsing and serialization happen locally. API payloads often contain tokens or personal data, so nothing is uploaded.