JSON minify
Minify and compress your JSON by removing unnecessary whitespace.
About JSON minify
Removes all unnecessary whitespace from JSON, producing the smallest equivalent text on a single line. Comments and trailing commas in JSON5 input are stripped too, so the output is always standard JSON.
When you would use it
- Shrinking a JSON payload before embedding it in a URL, an HTML attribute or a configuration string.
- Converting a commented JSON5 config into the strict JSON a parser demands.
- Putting a JSON document on one line for a log entry, an environment variable or a curl command.
How to use it
- Paste the JSON into the left field; JSON5 syntax with comments is accepted.
- Read the single-line result on the right.
- Copy it.
Things worth knowing
- Only whitespace outside of strings is removed. Spaces and line breaks inside string values are kept, because they are part of the data.
- The input is parsed and re-serialised, so comments disappear, duplicate keys keep only the last value, and numbers are normalised (1.0 becomes 1, 1e3 becomes 1000).
- Minifying typically saves 20 to 40 percent on indented JSON. For real bandwidth savings, gzip or brotli compression on the server matters far more.
- Invalid input shows an error and no output.
Frequently asked questions
- Why did 1.0 become 1?
- JSON numbers have no formatting; 1.0 and 1 are the same value, and the serialiser writes the shortest form. If the distinction matters, store the value as a string.
- How do I make it readable again?
- Use the JSON prettify and format tool, which indents the same data back into a multi-line layout.