JSON Minifier

Paste JSON to remove every unnecessary space and line break. The result is checked as valid JSON first, the saving is shown in bytes and percent, and your data stays in your browser.

JSON input

Minified JSON

Your minified JSON will appear here. Paste JSON on the left or press Load sample.

Options

How to minify JSON

  1. Add your JSON. Paste it, drop a .json file onto the page, or press Load sample.
  2. Read the saving. Valid JSON is minified at once and the size before and after is shown. Invalid JSON gets a line, a column and a suggested fix instead.
  3. Copy or download. Copy the one-line result or save it as a .min.json file.

There is no minify button. The result updates as you type.

Before

{
  "id": 7,
  "tags": ["a", "b"],
  "active": true
}

After

{"id":7,"tags":["a","b"],"active":true}

What minifying JSON removes

Minifying deletes only whitespace that sits between tokens: spaces, tabs and line breaks after commas, colons, brackets and braces. Whitespace inside a string is part of the value and is never touched. Because this tool reads the text instead of parsing and re-writing it, numbers, key order and escape sequences come out exactly as they went in, so the minified file means the same thing as the original.

JSON has no comments, so there is nothing else to strip. If your input has comments or trailing commas, turn on Auto-fix and they are removed as part of the repair.

How much smaller does it get?

The saving depends on how the JSON was formatted. Pretty-printed JSON with 2 or 4 space indents and deep nesting often shrinks by 20 to 40 percent. JSON that is already compact, such as most API responses, shrinks by little or nothing, and the tool says so instead of promising a number.

SituationTypical result
Pretty-printed config or exportClearly smaller, often a quarter or more
Deeply nested, indented 4 spacesLargest saving
Already one lineSame size or only a few bytes less
Mostly long stringsSmall saving, because the text itself dominates

When the response is served with gzip or Brotli, which most servers do, the difference between minified and pretty-printed JSON shrinks a lot, because repeated spaces compress well. Minifying still helps for storage, for payloads in URLs or headers, for logs, and for files that are shipped without compression.

What this minifier does

Private by design
Minifying runs in your browser with JavaScript. Your JSON is not uploaded.
Validates while it works
You find out at once if the JSON is broken, with the exact line and column.
Does not change values
Large IDs, trailing zeros, exponents and escapes such as \u00e9 are preserved.
Both directions
Switch the layout option to pretty-print the same JSON again. The JSON Formatter adds a tree view and more checks.
Other formats
Convert to YAML, XML or CSV once it is valid.

Frequently asked questions

How do I minify JSON online?

Paste the JSON or drop a .json file on the page. It is validated and minified straight away, and the size saving is shown. Press Copy, or Download .min.json to save it.

Is my JSON uploaded to a server?

No. Everything runs in your browser tab and nothing is sent anywhere.

Does minifying change the data?

No. Only whitespace between tokens is removed. Strings, numbers, key order and escape sequences are kept exactly as written.

What is the difference between minifying and compressing?

Minifying rewrites the text to be shorter and stays readable by any JSON parser. Compressing, such as gzip, turns the bytes into a binary format that must be decompressed first. They work together: minified JSON compresses to a smaller file than pretty-printed JSON, but by a smaller margin.

Why did my file barely shrink?

It was probably already compact. Minifying removes whitespace between tokens only, so JSON with no indentation, or with mostly long strings, has little to remove.

Why does it say my JSON is invalid?

JSON is stricter than a JavaScript object. Trailing commas, single quotes, comments and unquoted keys are not allowed. The error shows the line and column, and Auto-fix repairs these common mistakes.

Can I make minified JSON readable again?

Yes. Change the Layout option to an indent, or paste it into the JSON Formatter. Formatting restores the structure but not comments, which JSON cannot hold.

Can I minify JSON Lines or several documents?

This page expects a single JSON document. Wrap the lines in an array first, or convert them with the JSON to CSV tool, which reads JSON Lines.

Does it sort the keys?

Only if you ask. The sort option orders object keys alphabetically at every level and leaves arrays in order. By default the key order is untouched.

Is there a size limit?

Files up to 100 MB can be loaded. Very large files take a few seconds, and the text view shows only the first part of a huge result; Copy and Download still give the whole thing.