Format Code Now
/

JSON Minify

FV-05

Paste JSON and press Minify to remove every space and line break outside strings. Press Size saved to see how many bytes that removed. Numbers and strings stay exactly as written.

Runs in your browser. Nothing is uploaded.

JSON

Minified JSON

How to use it

  1. Paste your JSON into the input box, or open a .json file (up to 5 MB) or drop it on the box.
  2. Press Minify. The one-line result appears as you type.
  3. Turn on Sort keys or Escape non-ASCII if you need either.
  4. Press Size saved to see the input and output size in bytes and the percentage saved.
  5. Copy the result or download it as a .json file.

What minifying changes and leaves alone

Minify removes the spaces, tabs and line breaks that sit between tokens. Everything inside a string stays, including spaces and escape sequences such as \u00e9. Number text is copied as written, so 1.50 stays 1.50 and 12345678901234567890 is not rounded. Keys keep their order unless you turn on Sort keys. No key is shortened and no value is removed, so the data is the same and only the text is smaller.

Size saved and what it measures

Size saved reports the byte count of your input and of the minified text in UTF-8, then the bytes saved and the percentage. Bytes are used because accented letters and emoji take two to four bytes each. Deeply nested, pretty-printed JSON usually loses the most. The figure covers the raw text only. It does not include gzip or Brotli, which a web server may apply on top and which also shrink repeated text.

The two optional settings

Sort keys orders the keys of every object by character code, so capital letters come before lowercase. Escape non-ASCII rewrites each character above U+007F as a \u escape, with emoji written as a pair, which makes the output plain ASCII but longer. It helps when a system mishandles UTF-8. Both settings change the text but not the data, and arrays are never reordered.

Error messages and what to do

MessageWhat it meansFix
Expected a string keyAn object key was expected in double quotes. A single quote, a bare word or a comma before the closing brace causes it.Quote the key with double quotes or remove the extra comma.
Expected ',' or '}'The next character after a member is neither a comma nor the closing brace. Arrays give the same message with ']'.Add the missing comma or remove the comment.
Unexpected characterA character that cannot start a JSON value, such as a single quote, NaN or undefined.Replace it with a valid value.
Unexpected end of inputThe text ended while a value or bracket was still open.Add the missing value or closing bracket.

Questions people ask

How do I minify JSON?

Paste the JSON and press Minify. All spaces, tabs and line breaks outside strings are removed and the result is one line. Copy it or download it as a .json file. The data itself does not change.

Does minifying JSON change the data?

No. Keys, values, number text and string escapes are copied as written. Only whitespace between tokens is removed. If you turn on Sort keys or Escape non-ASCII, the text changes but a parser still reads the same data.

How much smaller does minified JSON get?

It depends on the input. Press Size saved to see the exact bytes and percentage for your own text. Pretty-printed JSON with deep nesting loses more than JSON that was already compact.

Is minified JSON the same as compressed JSON?

No. Minifying removes whitespace and the result is still readable text. Compression such as gzip encodes the bytes into a different form that must be decompressed. Servers often apply gzip on top of minified JSON.

How do I turn minified JSON back into readable JSON?

Use a JSON formatter to add indentation again, or the Format if valid action in the JSON Validator. Whitespace removed by Minify cannot be restored exactly, but formatting produces a standard layout.

Does it round large numbers in my JSON?

No. Number text is kept exactly, so an ID such as 12345678901234567890 comes out unchanged. Many tools parse the JSON into JavaScript numbers first, which would round it. This one does not.

About this tool

Removes every space, tab and line break outside strings. Keys, values, number text and string escapes are left exactly as written, so big numbers are not rounded. Minify does not shorten keys or change data; the only optional changes are sorting keys and writing non-ASCII characters as \u escapes. "Size saved" compares UTF-8 byte counts of the input and the minified text. Gzip on a server usually shrinks a minified file further, and this tool does not measure that.

Format Code Now: free, no ads, no accounts. Your input stays in your browser.