Skip to content
codevory

JSON Minifier

Remove every optional space and line break from JSON to make it as small as possible, without changing a single value.

JSON Minifier: the tool

Paste JSON to remove every optional space and line break.

Input

Minified JSON

The result appears here.

How to use JSON Minifier

  1. Paste formatted or pretty-printed JSON into the left panel.
  2. The minified result appears on the right. The status bar shows the size before and after.
  3. Copy it, or download it as a .json file. Use Use as input to chain it into another step.
  4. If the JSON is invalid, nothing is minified and the error is shown with its line and column.

Example

A formatted document and its minified form. Only whitespace is removed.

Input
{
  "name": "codevory",
  "tools": [
    "json",
    "yaml"
  ],
  "private": true,
  "owner": null
}
Output
{"name":"codevory","tools":["json","yaml"],"private":true,"owner":null}

About this tool

Minifying removes the whitespace that JSON allows between tokens: indentation, line breaks and the space after colons and commas. The data is unchanged. Typical pretty-printed documents shrink by 20 to 40 percent, more when they are deeply nested.

This tool does not parse numbers into JavaScript doubles, so a 20-digit identifier or a number such as 1.10 comes out exactly as it went in. Strings and escape sequences are untouched, and key order is preserved.

Minified JSON is the right form for payloads, storage and URLs, and pretty-printed JSON is the right form for people. For network transfer, also enable gzip or Brotli on your server: it compresses the repetition that minification cannot remove.

Frequently asked questions

Does minifying JSON change the data?

No. Only whitespace outside of strings is removed. Values, key order and the exact text of numbers and strings are preserved, including very large integers.

How much smaller will my JSON get?

It depends on how it was indented. Documents with deep nesting and short values save the most, often a third or more. The status bar shows the exact before and after sizes.

Is minification the same as compression?

No. Minification removes unneeded characters and the result is still plain JSON. Compression such as gzip encodes the data in a binary form that must be decompressed. They work well together.

Can minified JSON be turned back into readable JSON?

Yes, with the JSON formatter. Comments never existed in JSON, so nothing is lost in either direction.

What if my JSON has comments or trailing commas?

It is not valid JSON, so it cannot be minified safely. The error message identifies the comment or comma so that you can remove it first.