← All blog posts

How to use the JSON Minifier — step by step

WhiteUI · A plain-English guide to the JSON Minifier

Pretty JSON is easy to read and a waste of space: every line break and every space used for indenting is a byte that carries no meaning. The JSON Minifier strips all of that out and hands you the same data on one line. Paste your JSON in, read the minified result, copy it, and you are done. The five steps below use the exact examples the tool itself shows, with the real byte counts.

At a glance

The default example: 9 of 22 bytes savedSaved 9 bytesKept 13 bytes22 → 13 bytes · 40.9% smaller
Minifying the default example saves 9 of 22 bytes: the result is 13 bytes, which is 40.9 percent smaller.

Step 1: open the tool and look at the starting example

The tool opens with an example already filled in: a small piece of JSON with two items, a on one line and b on the next, written across five lines with two-space indenting. The result panel already shows the answer for it, so you can see what the tool does before you paste anything of your own. The starting example is 22 bytes, and the minified result is 13 bytes, so the tool has already saved 9 bytes before you have typed a word.

Step 2: paste your own JSON into the box

Click into the box on the left, clear the example, and paste your JSON in. It can be a settings file, a list of records, or a whole API response, and it can run to hundreds of lines. The tool reads it the moment you paste, so there is no button to press and no waiting. If your JSON is already on one line, paste it anyway: the tool will still check it and tell you how many bytes it is.

Step 3: read the result on the right

The right-hand panel shows three things: the big line at the top says how many bytes were saved, and below it two smaller lines give the original size and the minified size. For the default example the big line reads 9 bytes, the original line reads 22 bytes and the minified line reads 13 bytes. Underneath, the output box holds the minified JSON itself, on a single line, ready to copy. A small bar under the output shows the same split: purple for what is kept, green for what was saved.

Step 4: copy the minified JSON

Press the Copy minified JSON button and the one-line result goes onto your clipboard. Paste it where it needs to go: into a settings file, a code editor, a message, or a form field that only accepts one line. The result is ordinary JSON, so anything that could read your original can read the minified version too, because the values are exactly the same and only the spacing is gone.

Step 5: fix it if the tool says the JSON is invalid

If your JSON has a mistake, the tool does not guess: it says the JSON is invalid, shows the error message, and leaves your input exactly as you pasted it, so you can find the mistake and try again. The most common mistake is a comma after the last item in a list, which JSON does not allow. Remove that comma, and the tool will minify the file at once.

Worked example

Take a small profile, written with two-space indenting across seven lines: a name, Priya Sharma, an age of 28, a city, Pune, and a subscribed flag set to true. Pasted in, it measures 81 bytes. The minified result is {"name":"Priya Sharma","age":28,"city":"Pune","subscribed":true}, which is 64 bytes. That is 17 bytes saved, or 21.0 percent. The saving grows with the file: more lines and more indenting save a bigger share.

The common mistake

People copy the text from the input box instead of the output box, and paste the pretty version where the minified version was meant to go. The two boxes sit side by side and look alike, so check before you paste: the output box holds one long line with no line breaks. If what you pasted has line breaks in it, you copied the wrong box.

Frequently asked questions

What do I paste into the JSON Minifier?

Pretty JSON with line breaks and spaces, such as a settings file or an API response. The tool reads it the moment you paste it in.

Where is the minified result?

In the output box on the right, on a single line. The Copy minified JSON button copies it to your clipboard.

How much smaller does the result get?

It depends on the indenting: the default example goes from 22 to 13 bytes, saving 9 bytes, and a small profile goes from 81 to 64 bytes, saving 17 bytes.

What happens if my JSON is invalid?

The page says the JSON is invalid and shows the error message, without clearing your input, so you can fix it and try again.

More guides on the JSON Minifier

Try it yourself

Try the JSON Minifier — free, in your browser.

Open the JSON Minifier