Skip to content

Developer Tools

JSON Minifier

Validate and compress JSON into a single line, with exact before/after byte counts and an optional key-sorting step.

Input is validated before minifying, so invalid JSON never passes silently. Runs locally.

Minify for the Wire, Never for the Working Copy

Whitespace removal typically saves 20–40% on pretty-printed JSON, which matters for API payloads, config shipped to browsers, and anything metered by transfer. But minified JSON ends the file editability: the working copy with indentation stays the source of truth, and minification is a build/deploy step — hand-editing minified JSON is how stray commas and lost brackets happen. Validating before minifying catches the trailing comma that minifiers will happily preserve and parsers will reject.

What Minification Removes

  1. Paste your formatted JSON — the tool validates it before minifying so invalid input never passes silently.
  2. Enable key sorting if you want deterministic output for version control or caching.
  3. The minifier strips all insignificant whitespace between tokens.
  4. Exact original and minified byte sizes are shown so you can quantify the saving.
Formula & Technical Standard
Minified bytes = JSON.stringify(parsed). Savings % = (1 − minified/original) × 100.

Example Input & Output

Shrink a config for a CDN
Input: 18.4 KB pretty-printed JSON
Output: 11.2 KB minified (−39%)
Whitespace is pure overhead in transport; minifying is a standard deployment step.
Deterministic snapshots
Input: Sorted keys enabled
Output: Stable output across runs
Sorting keys makes JSON fixtures diff-friendly in code reviews and test snapshots.

Common Questions

Does minifying change the data?

No. Whitespace between tokens is not part of the data. With key sorting off, even the key order is preserved.

What happens with invalid JSON?

The tool reports the syntax error instead of producing a broken output, so you fix the source first.