Skip to content

JSON Minifier

Compress a JSON document to one compact line and see how many bytes you saved.

Processed locally in your browser

0 chars · 0 lines
The result will appear here.

What is JSON Minifier?

Minifying JSON removes every character that carries no meaning: spaces, tabs and line breaks between tokens. The data is identical, but the text is shorter, which helps with request size, storage and copy-pasting into a single-line field.

The tool validates the document first, then prints it without any whitespace outside of strings. Numbers and escape sequences inside strings are kept exactly as you wrote them, and a small report shows the original size, the minified size and the percentage saved.

How does it work?

  1. Paste your formatted JSON in the input area.
  2. The minified single-line result appears immediately, with the size before and after.
  3. If the JSON is invalid, fix the position shown in the error message (line and column).
  4. Copy the result or download minified.json.

Common use cases

  • Embedding a JSON config in an environment variable, a CSV cell or a URL parameter.
  • Reducing the size of a JSON fixture stored in a repository or sent in a test request.
  • Producing one-line JSON logs or JSON Lines records from a pretty-printed sample.
  • Comparing two documents by stripping formatting differences first.

Examples

Try this input in the tool above:

Input
{
  "name": "Ada Lovelace",
  "born": 1815,
  "fields": [
    "mathematics",
    "computing"
  ],
  "active": false
}
Output
{"name":"Ada Lovelace","born":1815,"fields":["mathematics","computing"],"active":false}

Privacy

JSON Minifier runs entirely in your browser. The text or files you provide are processed on your device and are not uploaded, logged or stored on our servers.

Limitations

Minification only removes whitespace: it does not shorten keys or compress data. For network transfer, gzip or Brotli saves far more.

Frequently asked questions

Can minifying break my JSON?

No. Only whitespace outside strings is removed, so the parsed data is identical. Spaces inside string values are never touched.

How much smaller will my file get?

It depends on the indentation. Deeply indented, pretty-printed files often shrink by 20–40%, while an already compact file changes very little. The tool displays the exact saving.

Are key order and big numbers kept?

Yes. Keys stay in their original order and numbers keep their exact digits, including integers larger than JavaScript can represent exactly.

More tools in JSON & Data →