JSON minifier

Paste your JSON and get the smallest valid version: no spaces, no line breaks, no indentation. It is checked as it is minified, and the size you save is shown.

  • Free
  • No sign-up
  • Runs in your browser
json-minifier

100% private — your text is processed in your browser and never sent to any server.

How it works

Paste your JSON

From a file, an API response, a configuration or an editor.

Get the minified version

It is validated as it is minified. Errors are shown with their exact line and column.

Copy or download

Use it in a request, a script tag, a configuration value or a file.

Smaller JSON, same data

Pretty-printed JSON is written for people, with a new line and an indentation for every item. Programs do not need any of that. Minifying removes every space, tab and line break that is not part of a value, which makes the text shorter without changing a single piece of data. For large documents the saving can be worthwhile: smaller payloads travel faster, fit into fields with a length limit and take less space in a URL, a cookie, a configuration variable or a database column.

What minifying changes, and what it does not

Only the whitespace between the elements is removed. Strings keep every space inside them, the order of the keys is kept as it is (unless you choose to sort them), and numbers are written exactly as you wrote them, so a long identifier such as 12345678901234567890 comes out unchanged instead of being rounded, as happens when JSON is converted through a program that reads numbers as floating-point values. Nothing about the meaning of the document changes; you can format it again at any time with the JSON formatter.

Validation on the way

The document is read according to the JSON standard before it is compressed, so a missing bracket, a trailing comma or a value in single quotes is reported with the line and column where it goes wrong, instead of producing a broken output. If the input comes from a chat, a configuration with comments or an object copied from code, switch on "Repair common mistakes first": single quotes, trailing commas, comments, unquoted keys and similar are fixed before minifying.

Size saved

Below the result you see the size before and after and the percentage saved. Indented JSON with short values often shrinks by a third or more; a document that was already compact will show little or no saving.

What it does not do

Minifying is not compression in the sense of gzip: it does not reduce the size to what a compressed transfer would give, though servers usually compress and minified JSON compresses well too. It does not shorten keys, remove unused fields or change any value. Use it as one step, alongside compression, to make a document lighter.

Frequently asked questions

How do I minify JSON?
Paste your JSON and copy the result. All the spaces, line breaks and indentation that are not part of a value are removed.
Does minifying change my data?
No. Only whitespace between elements is removed. Strings, numbers and the order of the keys stay as they were, unless you choose to sort the keys.
Will large numbers be rounded?
No. Numbers are kept exactly as written, so long identifiers are not altered.
Does it validate the JSON?
Yes. Invalid JSON is reported with the line and column of the error, and no output is produced.
Can it fix JSON with single quotes or comments?
Yes. Tick "Repair common mistakes first" and the usual problems are fixed before minifying.
Is my JSON uploaded anywhere?
No. It is processed in your browser.