JSON Minifier

Minify JSON by removing all spaces and line breaks, and see how many characters you saved. Validates as it goes. Free, runs in your browser, nothing uploaded.

Runs in your browser. Your files are never uploaded. How it works

JSON Minifier strips every unnecessary space, tab and line break from JSON and puts it on a single line, ready for an API request, a config value or an HTML attribute. It checks the JSON as it goes, so you never ship a broken file, and it tells you how many characters you saved. Your data stays in your browser.

How to minify JSON

  1. Paste your JSON, or click Open file to load a .json file. A file is minified as soon as it opens.
  2. Click Minify.
  3. Check the status line, for example “Minified: 4,812 → 3,105 characters”.
  4. Click Copy result or Download .json.

Tick Sort keys A–Z before minifying to get the same output every time for the same data, which helps with caching and comparing.

Formatted versus minified

Formatted Minified
Readable by people Yes Hard
Same data Yes Yes
Size Larger Smallest
Good for Code review, docs, editing APIs, storage, embedding

Example, formatted:

{
  "name": "Ann",
  "tags": ["admin", "editor"]
}

The same JSON minified:

{"name":"Ann","tags":["admin","editor"]}

When to minify

  • API payloads and responses, where every byte is sent on every request.
  • Values in environment variables or a single-line config field.
  • JSON embedded in HTML, in a data- attribute or a script tag.
  • Storing JSON in a database column, local storage or a cache key.
  • Test fixtures where you want one record per line.

Servers usually also compress responses, so the saving on the wire is smaller than the character count suggests. Minifying still helps where no compression is applied, such as storage and environment variables.

Errors

If the JSON is not valid, the minifier shows the line and column of the first error instead of a result. Click Repair to fix trailing commas, comments or single quotes, or see the JSON Validator for the common errors and fixes. To make JSON readable again, use the JSON Formatter.

Frequently asked questions

What does minifying JSON do?

It removes every space, tab and line break that is not inside a string. The data stays exactly the same, only on one line and smaller. Any program reads minified and formatted JSON the same way.

How much smaller does JSON get?

It depends on how it was formatted. JSON indented with 2 or 4 spaces often shrinks by a quarter to a half; deeply nested files save the most. The tool shows the character count before and after.

Is minified JSON still valid?

Yes. Minifying only works on valid JSON: the tool parses it first, so if there is an error, you see the line and column instead of a broken result.

Can I turn minified JSON back into readable JSON?

Yes. Click Format to indent it again with 2 spaces, 4 spaces or tabs. Nothing is lost by minifying except the whitespace.

More ways to use JSON Formatter

Related tools