Skip to content
Toolora

JSON Minifier

Compress JSON to a single line by removing all whitespace and indentation, and see exactly how many bytes you saved.

Developer Runs in your browser Works offline
Loading tool…

How it works

Minifying re-serialises the parsed value with no indentation, so every space, tab and newline between tokens disappears. The data is untouched — only the presentation shrinks.

Savings depend on how the JSON was written. Deeply nested, four-space-indented files often shrink by 30–50%; a file already on one line will not change at all.

The formula

Minify

JSON.stringify(JSON.parse(input))

Saving

saved % = (1 − minified length ÷ original length) × 100

Worked examples

ScenarioWorkingResult
A 2-space indented objectWhitespace removedTypically 20–40% smaller
{ "a": 1 }Minify{"a":1}
Already minified JSONMinifyUnchanged, and still validated

When you'd use it

  • Shrinking a request body before pasting it into a client
  • Cutting bytes from a config file shipped to the browser
  • Putting JSON on one line for a log entry or an env variable
  • Confirming a payload is valid while you compress it

Common questions

Does minifying change my data?

No. Keys, values, types and array order all survive exactly. Only whitespace between tokens is removed, so the parsed result is identical.

Is it worth minifying JSON if my server uses gzip?

Usually marginal. Gzip compresses repeated whitespace very effectively, so the real-world saving over the wire is small. Minifying still helps where the JSON is stored uncompressed — env variables, database columns, log lines.

Is my JSON uploaded?

No. Parsing and minifying happen entirely in your browser, so nothing you paste leaves your machine.