How to use a JSON minifier

JSON minification removes spaces, tabs, and line breaks outside strings, producing compact valid JSON without changing the represented values.

Open the JSON Minifier

What JSON minification preserves

Whitespace between tokens is optional in JSON. A minifier removes it while preserving spaces inside strings, number spellings, escape sequences, key order, and duplicate keys.

This is a textual transformation, not canonicalization. Two semantically similar documents can still have different minified bytes because key order or number notation differs.

How to minify JSON

  1. Paste JSON or open a JSON file.
  2. Select Minify JSON.
  3. If parsing fails, correct the first reported syntax error.
  4. Compare input and output byte counts.
  5. Copy or download the compact result.

Invalid JavaScript object notation cannot be minified as JSON. Replace single quotes, comments, trailing commas, undefined, NaN, and Infinity with valid JSON forms first.

A minification example

Readable input

{
  "message": "two words",
  "active": true
}

Minified output

{"message":"two words","active":true}

The space inside "two words" remains because it is part of the string value.

Minification is not compression

MethodOutputReversal
JSON minificationValid readable textFormat it again
Gzip or BrotliCompressed bytesDecompress the response

HTTP compression often provides the larger transfer saving because JSON repeats property names and syntax. Minification can still reduce source size and logging noise.

When not to minify

  • Do not replace the maintained source if humans edit it directly.
  • Do not minify before reviewing a complex configuration.
  • Do not assume the output is a stable signature format.
  • Do not use minification as schema or business-rule validation.

Keep readable JSON in version control and generate compact JSON for delivery when that workflow is available.

Try it with ToolPixels

Minify valid JSON locally while preserving strings, numbers, escapes, key order, and duplicate keys.

Minify JSON now