Formula
minified = JSON with every space, tab and line break outside strings removed
- Strings, numbers and key order are unchanged.
Same data, fewer characters.
Worked example
Pretty-printed object
- JSON
- { "a": 1, "b": [1, 2, 3] }
Bytes saved
11 bytes
Before: 30 bytes
After: 19 bytes
Reduction: 36.7%
{"a":1,"b":[1,2,3]}How it works
Minifying removes the indentation and line breaks that make JSON readable but add weight. The tool parses first, so invalid JSON is reported instead of being silently mangled, then writes the same values back with no extra whitespace.
Whitespace inside strings is data and is preserved. The saving is usually 10–40% for pretty-printed files, though gzip compression on the network already removes much of the same redundancy. To reverse it use the JSON Formatter, and to check validity alone use the JSON Validator.
Assumptions and limits
- Output is a single line.
Related tools
JSON FormatterPretty-print JSON with 2 or 4 spaces or tabs and optional key sorting — numbers are never altered.JSON ValidatorCheck whether JSON is valid, with the exact line and column of any error and structure statistics.CSS FormatterFormat CSS with consistent indentation, or minify it, with errors that give the line number.Base64 Encode and DecodeEncode text to Base64 or decode Base64 to text, with URL-safe output and full Unicode support.HTML FormatterIndent and tidy HTML without changing its tags, attributes or text.