Tutorial · JSON Minifier · 3 min read

How to Minify JSON and Why It Matters

Strip whitespace and line breaks from JSON to shrink payloads before embedding them in code, config or an HTTP request, and see how many bytes you saved.

Pretty-printed JSON is for people; minified JSON is for machines. Removing indentation and newlines routinely cuts a payload by a third, which matters when the JSON travels in a query string, an environment variable, a database column or a mobile API response.

What you'll learn

  • Turn multi-line JSON into a single compact line
  • See the before and after size in bytes
  • Know when minifying helps and when gzip already does the job

Step by step

  1. Paste formatted JSON

    Open the JSON Minifier and paste the document. Indentation, blank lines and spacing are all fair game; string values are left untouched.

  2. Click Minify

    The output pane shows the compact form and a byte count for input and output, so you can quote the saving in a pull request.

    {
      "a": 1,
      "b": [1, 2]
    }
    
    →  {"a":1,"b":[1,2]}   (27 bytes → 17 bytes)
  3. Copy it where it needs to go

    Use Copy Output. If you are embedding it in a shell command or a YAML file, remember to quote it so the shell or YAML parser does not interpret the braces.

Open the tool with this example Runs in your browser. Nothing you paste is uploaded.

Common problems

The minified JSON is still large

Minifying only removes whitespace. Large payloads are usually large because of repeated keys or embedded base64; consider gzip at the transport layer, which most servers apply automatically.

Minify reports invalid JSON

The tool parses before it minifies, so the same rules apply as the formatter: double-quoted keys, no trailing commas, no comments.

FAQ

Does minifying change the data?

No. Only insignificant whitespace between tokens is removed. Strings, numbers and key order are preserved.

Should I minify JSON stored in a database?

Usually yes for text columns; it saves space and most databases with native JSON types re-serialise anyway.