Handitab

JSON Minifier

Minify JSON by removing all whitespace and line breaks, producing a single-line document that is valid and smaller to send or store.

About JSON Minifier

JSON (JavaScript Object Notation) is a text data format defined in RFC 8259 and ECMA-404. This tool parses your input with the browser's JSON.parse, which follows the specification strictly: no comments, no trailing commas, and double-quoted keys only. Valid input is printed again with JSON.stringify using the indentation you choose, or minified. Invalid input shows the parser's error message. Very large or very precise numbers may be rounded.

How to use JSON Minifier

  1. Type or paste into the "JSON" box, or press "Use example" to try it with sample data.
  2. Set "Output" and "Sort keys A to Z" if the defaults do not fit.
  3. The result appears below and updates as you type.
  4. Copy the result with the copy button, or download it as a file where that is offered.

Questions about JSON Minifier

Why is my JSON invalid when it works in JavaScript?

JavaScript object literals allow things JSON does not: single quotes, unquoted keys, trailing commas, comments, and values like undefined. Strict JSON requires double-quoted keys and strings and no trailing commas.

Does formatting change my data?

Only whitespace changes, plus key order if you turn on sorting. One exception: integers above 2 to the power of 53 and decimals with more than about 17 significant digits can lose precision, because they are parsed as JavaScript numbers.

Runs in your browser. Page last updated .

More developer tools

All 41 developer tools