JSON Minifier

Paste JSON and get it back on one line, with every space and line break between values removed. The note under the result says how many bytes that saved.

How it works

The JSON is read by the same parser as the JSON Formatter. It keeps numbers as the text you wrote and keys in their written order, so minifying never changes a value.

The tree is written back with nothing between the pieces: no spaces after colons or commas, and no line breaks. Spaces inside strings are part of the data and are kept.

The note compares the size of your input and the result in UTF-8 bytes, which is what a server sends. If the JSON is not valid, the first mistake is shown with its line and column instead.

How to use it

  1. 1 Paste your JSON into the first box.
  2. 2 The minified JSON appears in the second box as you type.
  3. 3 Check the note under it for the bytes before and after.
  4. 4 Press Copy result, or download it as a .json file.

Good to know

  • Minifying is also a quick validity check: if a result appears, the JSON is valid.
  • If a file will be gzip or Brotli compressed when it is served, minifying saves less than the note suggests, because compression already squeezes runs of spaces. It still helps a little, and it helps a lot for JSON stored in a database column or a URL.
  • To read minified JSON again, paste it into the JSON Formatter.

Browser support

  • Chrome 94 and later
  • Firefox 93 and later
  • Safari 16.4 and later
  • Edge 94 and later

These are the oldest versions with everything the tool uses. They are worked out from the tool itself, so they change when it does.

Version numbers checked on 2026-09-04.

What minifying JSON saves, and when it is worth it

JSON is often written for people: two or four spaces of indent, a line per key, a space after each colon. Machines do not need any of that. Minifying removes it, so the same data takes fewer bytes on the wire and in storage. A typical pretty-printed API response shrinks by 20 to 40 percent, and deeply nested data with long indents shrinks more. The note under the result tells you exactly how much your file saved, in the UTF-8 bytes a server would actually send.

The saving matters most where nothing else compresses the data. JSON stored in a database text column, sent in a URL or a cookie, kept in localStorage, or embedded in an HTML page as a script block is stored exactly as written, so every space costs a byte. For HTTP responses the picture is different. Servers usually compress JSON with gzip or Brotli, and those are very good at squeezing repeated spaces. Minifying first still trims a few percent, but the big win has already happened.

A minifier must not change the data, and the usual shortcut does. JSON.parse followed by JSON.stringify removes the whitespace, but it also rounds any number longer than about 16 digits and moves keys that look like numbers to the front of each object. A 64-bit ID such as 1234567890123456789 comes out as a different ID. This tool reads the JSON with its own parser, which keeps numbers as the digits you wrote and keys in the order you wrote them, so the minified output is the same data with less space.

Spaces inside strings are data, so they stay. "New York" keeps its space, and a string that contains a line break keeps it as the escape \n. The one change inside strings is cosmetic: escapes such as \u00e9 are written as the character é and \/ as /. Every JSON reader treats the two forms as the same text, and the plain form is usually shorter.

If the JSON is not valid, nothing is written. The first problem is shown with its line, column and a plain cause, such as a trailing comma after the last item, a comment, or a string in single quotes. That makes the minifier a fast validity check as well: paste, and if a one-line result appears, the JSON is valid. Everything happens in this page, so you can minify private data without sending it anywhere.

Frequently asked questions

Does minifying change any values?

No. Numbers are copied digit for digit, keys stay in order, and the text inside strings is untouched. The only change inside a string is that escapes such as \u00e9 are written as the character itself, which every JSON reader treats as identical.

Why is the result sometimes larger than I expected?

The byte count is in UTF-8. An accented letter takes two bytes and most emoji take four, so text in many languages is larger in bytes than in characters. Writing \u00e9 as é usually makes the output smaller, not larger.

Is there a size limit?

Up to 2 MB of text at a time, so the page stays responsive on slower phones. Past that the tool says so rather than freezing the tab.

Is my JSON sent anywhere?

No. It is read and written in this page, and nothing is uploaded.

Related tools

Your files are processed on your device and are not uploaded. You can verify this in your browser’s developer tools under the Network tab.