JSON Minifier Online

Minify JSON by removing spaces and line breaks. Make your JSON smaller and faster to send, with the same data.

JSON Input

Ln 1, Col 1Empty

Minified JSON

Your result will appear here.
No result yet

What Is a JSON Minifier?

A JSON minifier removes every space, tab and line break that JSON does not need. The result is one compact line with exactly the same data. Minified JSON is smaller, so it loads faster, costs less bandwidth and is ideal for APIs, web apps and config files.

How to Minify JSON

  1. Paste your JSON into the JSON Input box, click Upload, or drop a .json file.
  2. Click Minify JSON, or press Ctrl + Enter.
  3. See how much smaller your JSON became, then click Copy or Download.
  4. Need it readable again? Click Beautify.

Features

  • Shows the size before and after, and the percentage saved.
  • Fixes common mistakes (trailing commas, single quotes, comments) before minifying.
  • Beautify button to turn minified JSON back into readable JSON.
  • Runs in your browser. Your JSON is never uploaded.

Before and After

Formatted (103 bytes)
{
  "id": 1024,
  "name": "Emily Clark",
  "roles": [
    "admin",
    "editor"
  ],
  "active": true
}
Minified (73 bytes)
{"id":1024,"name":"Emily Clark","roles":["admin","editor"],"active":true}

The data is identical, but the minified version is about 30% smaller, and the savings grow with deeper nesting. Only spaces and line breaks outside of strings are removed, so the text inside your values, like "Emily Clark", is never changed.

When to Minify JSON (and When Not To)

  • Minify JSON that is sent over the network, stored in a database or cache, embedded in a web page, or saved in large numbers of files.
  • Keep it formatted in files people read and edit, such as config files in a Git repository, so changes are easy to review.
  • Servers usually also compress responses with gzip or Brotli. Minifying and compressing together give the smallest result. See both sizes with the JSON Size Calculator.
  • Sending JSON to ChatGPT or Claude? JSON to TOON often makes lists of records even smaller than minified JSON, so the prompt uses fewer tokens.

Minify JSON in Code

JavaScript
const minified = JSON.stringify(JSON.parse(text))
Python
import json
minified = json.dumps(data, separators=(",", ":"))
Command line (jq)
jq -c . data.json > data.min.json

To do the opposite and make JSON readable again, see how to pretty print JSON.

Frequently Asked Questions

What does a JSON minifier do?

It removes all spaces, tabs and line breaks that are not needed, so the JSON becomes one compact line. The data stays exactly the same.

Why should I minify JSON?

Smaller JSON loads faster, uses less bandwidth in APIs and takes less space in storage and config files.

Can it minify JSON that has errors?

Yes, for common mistakes. Trailing commas, missing commas, single quotes and comments are fixed automatically before minifying.

Is my JSON uploaded?

No. The minifier runs in your browser and your data never leaves your device.

Related Tools