JSON Minifier
Remove all whitespace and comments for high-performance production JSON
Shrink formatted JSON into a single compact line
Pretty-printed JSON is pleasant to read, but every indent, space and line break adds characters that a parser ignores. The JSON Minifier takes an indented document and rewrites it as one continuous line with all of that formatting removed. The data itself is unchanged: same keys, same values, same order. Only the layout shrinks, which helps when you are embedding a payload in a config value, a query string, a test fixture or a source file where one line is easier to handle.
Minifying a document, step by step
- Paste your formatted JSON into the Raw JSON box, or press Load Sample to see an indented example.
- Watch the Original counter in the header update as you type. It shows the length of your input in characters.
- Press Minify JSON Now.
- Read the Minified Result panel. The Minified counter shows the new length and Savings shows the percentage removed.
- Press Copy Minified to put the single-line text on your clipboard, or Clear to start over.
How it works and what it checks
The page parses your text with the browser's own JSON parser and then serializes the resulting value without any spacing. Because it has to parse first, the tool doubles as a quick syntax check: if the input is not valid JSON, an Invalid JSON message appears with the parser's explanation instead of producing output. The work happens in your browser tab through JavaScript, and there is no separate download button, so the copy button is how you take the result away.
Where minified JSON is useful
- Pasting a sample response into an environment variable, a CI secret field or a single-line configuration setting.
- Building a compact body for a curl command or an API request that you will send from a terminal.
- Reducing the size of a JSON blob before you store it in a text column or a cache key.
- Comparing two documents by eye after both have been reduced to the same layout.
Things worth knowing
- Standard JSON does not allow comments or trailing commas. Input containing them will be rejected rather than silently cleaned, so remove them first.
- The savings figure compares the trimmed input with the output, so already-compact JSON will show a low or zero percentage.
- Numbers and strings are re-serialized by the parser. Very large integers can lose precision, and a number written as 1.0 comes back as 1.
- Unicode escapes inside strings may be output as the actual characters, which is still equivalent JSON.
- Minifying is not compression in the gzip sense. Servers that compress responses will still gain a little from removing whitespace, but do not expect the savings percentage to match transfer size.
Related Tools