Free JSON Minify Tool
Shrink JSON to a single compact line by removing every space, tab and line break that carries no meaning. Values and key order stay the same, and the result is still valid JSON, free, with nothing uploaded anywhere.
Minified JSON
Your input never leaves this device — the conversion runs entirely in your browser.
What this tool does
This tool removes all insignificant whitespace from JSON: the spaces, tabs and line breaks used only to lay the document out for reading. The result is a single compact line holding exactly the same data, ready to paste, store or send where space matters.
Only whitespace outside strings is removed. Spaces inside string values are part of the data, so they are left exactly as they are. Values and key order are preserved, and no keys are added or renamed. Because the text is parsed and written out again, the spelling of escapes and numbers may change while the characters and values stay the same — for example, an escape such as \/ may print as /, and 1.0 may print as 1. If the same key appears twice, only the last value is kept, because that is how JSON parsing works. The minified output is still valid JSON, and any program that reads JSON can read it.
Minifying does not compress data like an archive file, and it does not shorten key names or remove fields. The saving comes only from removed layout whitespace.
The work runs entirely in your browser. Your input never leaves your device, nothing is uploaded, and there is no sign-up. The tool is free for any JSON you paste in.
How to use the JSON minify tool
Minifying takes a few simple steps. No installation is needed.
- Paste your JSON into the input area, including JSON spread over many lines with indentation.
- Start the minifying. If the JSON is invalid, the tool reports the problem instead of producing output, because invalid input cannot be minified safely.
- Read or copy the one-line result. It holds the same values as the input, with only layout whitespace removed.
- Paste the compact result where you need it, and keep the readable original for editing. A single long line is hard to edit by hand.
If you need to read the compact result again later, run it through a pretty print tool to restore the layout. The values survive both directions unchanged.
Worked example
The input below is a small object laid out over several lines, with a string value that contains spaces of its own.
{
"name": "Café Luna",
"city": "Lisbon",
"rating": 4.7,
"open": true,
"website": null,
"note": "Open every day",
"address": {"street": "Rua Nova 12", "postcode": "1100-123"},
"tags": ["café", "bakery"]
}The minified output is one line. The layout whitespace is gone, while the spaces inside the string values remain.
{"name":"Café Luna","city":"Lisbon","rating":4.7,"open":true,"website":null,"note":"Open every day","address":{"street":"Rua Nova 12","postcode":"1100-123"},"tags":["café","bakery"]}Compare the two blocks, ignoring layout. Every key and value is the same. The only difference is the whitespace between tokens, which carried no meaning.
Rules and edge cases
Whitespace between tokens is removed: spaces, tabs and line breaks that separate keys, values, commas, colons and brackets. Whitespace inside a string value is data, not layout, so it is never removed. The string Open every day keeps both of its spaces in the output.
Invalid JSON is reported, not fixed. Missing commas, missing brackets, trailing commas and single quotes are errors, and the tool does not guess a repair. Fix the reported problem in the input and minify again. The output is always one line when the input is valid.
Empty objects and empty arrays are unchanged, because they hold no whitespace to remove. A document that is already minified comes back with the same values, though escape and number spellings may be normalised. Minifying does not reorder keys, but if a key is repeated, only the last value survives, because the text is parsed before it is written out again.
Very large inputs may be slow, because the whole result is built in your browser. The output stays readable as text, only on one line, so extremely long documents can still be awkward to scroll through even after minifying.
Common mistakes
Most problems come from expecting minifying to fix, shorten or hide the data. It does only one thing: remove layout whitespace.
- Expecting minifying to fix invalid JSON. Errors are reported, and nothing is repaired.
- Expecting key names to be shortened or fields to be removed. No values change, so a long document stays long, only on one line.
- Expecting the result to be easy to read. One-line JSON is compact, not readable. Use pretty printing for reading.
- Pasting JSON with comments or trailing commas and expecting them to be stripped. Those make the input invalid, so remove them first.
- Treating minified JSON as hidden or protected. The text is still plain JSON, only compact, so anyone can read it by reformatting it.
When to use minify, and when to choose something else
Use minifying when space or shape matters: pasting JSON into a single-line field, embedding it in a configuration value, storing it compactly, or sending it where every byte counts. The one-line form fits places where line breaks are awkward or not allowed.
Use pretty printing when a person needs to read or edit the JSON. Use a validator when you only need to know whether the JSON is valid, without a reformatted copy. Use a diff tool when you need to compare two documents, since minifying two documents does not show what changed between them.
Keep a readable copy of anything you will edit again. Minify a copy for use, and keep the indented original for changes. Converting back with pretty printing restores readability, but the restored layout is fresh, not your original arrangement.
Frequently asked questions
Is minified JSON still valid JSON?
Yes. Removing insignificant whitespace does not change the data, so the one-line output is valid JSON. Any program that reads JSON can read the minified form.
Does minifying change my values?
No. Values and key order are preserved, and no keys are added or renamed. Only whitespace between tokens is removed, though escape and number spellings may be normalised because the text is parsed and written out again.
Are spaces inside strings removed?
No. Whitespace inside a string value is part of the data, so it is left exactly as it is. Only whitespace outside strings, used for layout, is removed.
Does minifying fix invalid JSON?
No. Invalid JSON is reported, not fixed. Fix the error in the input, such as a missing comma or bracket, and minify again.
Does it shorten key names or remove fields?
No. Minifying removes layout whitespace only. Key names, values and fields all stay exactly as written, on a single line.
How much smaller is the result?
It depends on how much layout whitespace the input held. Only whitespace is saved, so a heavily indented document shrinks noticeably, while an already compact document comes back unchanged.
Is my data uploaded anywhere?
No. The minifying runs in your browser on your own device. Your input is never sent to a server, and there is no sign-up or account.



