JSON Minifier

Minify JSON by removing all insignificant whitespace while keeping values, key order and big numbers intact. Shows the size saved. Free and in-browser.

Output

Runs entirely in your browser. Your data is never uploaded.

Related Tools

View All

What is JSON Minifier?

The JSON Minifier turns formatted JSON into a single compact line by removing spaces, tabs and line breaks that are not part of strings. Values, key order and number formatting stay exactly the same, and invalid JSON is reported with its line and column instead of being silently mangled.

How to use JSON Minifier

  1. Paste your JSON into the input box.
  2. Click Minify (the output also updates while you type).
  3. Check the size line under the output to see how many bytes were saved.
  4. Copy or download the minified JSON.

Example

Input
{
  "a": [1, 2],
  "b": "x y"
}
Output
{"a":[1,2],"b":"x y"}

When to use JSON Minifier

Use it to shrink JSON for embedding in a URL parameter, environment variable, test fixture or HTTP payload. Note that HTTP compression (gzip/brotli) already removes most of the cost of whitespace, so minifying is mainly about single-line convenience. Do not use it when people need to read or diff the file.

How JSON Minifier works

The text is parsed with a strict JSON parser and printed back without any indentation or spaces after : and ,. Because the output is generated from the parsed tree, whitespace inside strings is untouched and numbers are printed exactly as in the input. Sizes are measured in UTF-8 bytes.

Common Use Cases

  • Putting JSON into an environment variable or CLI argument
  • Reducing fixture file size in tests
  • Preparing a one-line JSON payload for curl
  • Checking that JSON is valid while compacting it

Security Note

Everything runs locally in your browser; the code you paste is not uploaded.

FAQs

Is the space inside "x y" removed?

No. Only whitespace between tokens is removed; string contents are preserved.

Does it change number precision?

No, numbers are copied as written.

What if the JSON is invalid?

You get an error with the line and column; nothing is output.

Good next steps

Explore more categories