JSON Minifier
Remove every space and line break that JSON does not need, for smaller payloads, config values and environment variables.
About the JSON Minifier
Pretty-printed JSON is easy on the eyes but full of spaces, tabs and line breaks that carry no data. Minified JSON drops all of them, which matters when a value must fit on one line or when every byte is counted, such as in a request body, a cookie or a mobile app bundle.
This page uses the same strict engine as the JSON formatter, with Minify (one line) already chosen.
When to use it
- You need a JSON configuration inside an environment variable or a single-line field.
- A message queue, webhook or log line expects one JSON document per line.
Worked example
Paste the following three-line document:
{
"name": "Asha", "city": "Pune",
"orders": [101, 102, 9007199254740993]
}
Press Format JSON. The result is {“name”:“Asha”,“city”:“Pune”,“orders”:[101,102,9007199254740993]} on one line. The last order number is larger than JavaScript can store exactly, yet it keeps every digit: many minifiers built on JavaScript’s own parser would silently change it to 9007199254740992.
What is removed and what is not
- Spaces, tabs and line breaks between keys, values and brackets are removed.
- Characters inside strings, including spaces and escape sequences such as \n, are not touched.
- Key order is kept. The Sort keys option only applies to indented output.
- Duplicate keys are kept as written, but the validator warns about them because most programs keep only the last one.
Checking before minifying
The input is parsed strictly before anything is written. A trailing comma, a comment, a single-quoted string or a missing bracket stops the process and points to the line and column, so you never get a minified file that other programs will reject. The JSON validator gives the same check with fuller statistics.
Good to know
- To make the result readable again, switch the indentation list to 2 spaces, 4 spaces or Tabs and press the button again.
- Up to 20 million characters are accepted.
How to use JSON Minifier
- Paste JSON. Minify (one line) is already selected.
- Select Format JSON.
- Copy the one-line result or download it as minified.json.
Privacy: how it works
Everything happens in your browser. Your text is not sent to any server.
Frequently asked questions
Is the minified JSON the same data?
Yes. Only whitespace outside strings is removed. Strings, key order and numbers, including very large ones, are kept exactly.
What if my JSON has an error?
Nothing is minified. You see the line and column of the problem, such as a trailing comma, so you can fix it.
How do I make it readable again?
Choose 2 spaces, 4 spaces or Tabs in the indentation list on this page, or use the JSON formatter.