JSON Minifier

Remove all unnecessary whitespace from JSON and see exactly how many bytes you saved.

JSON
Minified JSON
Runs locally in your browser

About the JSON Minifier

Minifying JSON removes the spaces, tabs and line breaks that exist only for human readers. Whitespace inside string values is untouched, so the data is identical; only the representation shrinks. For a typical pretty-printed API response the saving is 20 to 40 percent before gzip, and the stats line under the panes reports the exact figure for your input.

The tool parses the input first, which means it doubles as a validator: if a comma is missing or a string is unterminated you get the line and column rather than a silently broken file. It does not shorten key names, drop null values or reorder anything. Those are structural changes that would alter the meaning of the document.

Common uses are shrinking configuration files that ship with a web app, embedding JSON in an HTML data attribute, or checking how large a payload really is once the formatting is gone. Since the result is a single line, use the Download button rather than selecting the text if it is more than a few hundred kilobytes.

How to use

  1. Paste formatted JSON on the left or load a file with Upload.
  2. The single-line result appears on the right immediately. The stats line shows the byte reduction.
  3. Click Copy or Download. Swap opens the result in the JSON Formatter if you need it readable again.

Common questions

Does minifying JSON lose any data?
No. Only whitespace outside of strings is removed. Parsing the minified output gives exactly the same object as the original.
Should I minify JSON before sending it over HTTP?
If your server sends gzip or brotli, the extra saving from minification is small, often under 5 percent, because compression already collapses repeated whitespace. Minify when you cannot compress, or when the JSON is embedded in another file.
Can it minify a JSON file with comments?
Not directly, because comments are not part of JSON. Run the file through the JSON Fixer first, which strips comments, then minify.