Skip to content

JSON Minifier

Remove all the spaces and line breaks from valid JSON and see how many bytes that saves.

JSON minifier
Paste JSON; get the shortest form.

Result
Minified JSON
{"name":"Ana","tags":["a","b"],"active":true}
61 bytes
Before
45 bytes
After
26.2%
Saved

Private: Everything runs in this page. Nothing you type is sent anywhere or saved.

On this page
  1. Minify examples
  2. Formula
  3. How the json minifier works
  4. What this tool does not do
  5. Frequently asked questions
  6. References
  7. Related tools

Minify examples

JSONMinifiedSaved
{ "a": 1 }{"a":1}30%
[ 1, 2, 3 ][1,2,3]36.4%
{ | "k": [ true, null ] | }{"k":[true,null]}29.2%
"text""text"0%
{ "a" : { "b" : 2 } }{"a":{"b":2}}38.1%

Formula

saved % = (bytes before - bytes after) / bytes before x 100

How the json minifier works

  1. Step onePaste valid JSON.
  2. Step twoThe minified text appears at once, with the size before and after.
  3. Step threeCopy the result.

What this tool does not do

  • It does not shorten names or values; only whitespace is removed.
  • Very large numbers lose exactness, as in the browser's own JSON handling.
  • It does not compress with gzip or any other method.

Frequently asked questions

Does minifying change the data?

Only the spaces and line breaks between the values go, and text inside strings is untouched. Two things can still change, and the tool tells you when they do: a number with more digits than a browser can keep exactly is shown as the nearest value it can store, and a key that appears twice keeps only its last value. Numbers are also written in the shortest form (1.0 becomes 1) with the same value.

Why does it say my JSON is invalid?

JSON needs double quotes around names and text, no trailing commas and no comments. The message shows what the browser found.

How is this different from the JSON formatter?

The formatter makes JSON easy to read and can also minify. This tool is for minifying only and shows how many bytes were saved.

References