Konverter
JSON Minifier
The JSON Minifier removes all non-significant whitespace from JSON documents to produce the most compact valid JSON representation. Smaller JSON payloads reduce API response sizes, speed up parsing, and lower bandwidth costs in high-traffic systems. The tool also strips JSON5-style comments where present, since standard JSON parsers do not accept them.
What is JSON minification?
A JSON document contains the actual data (keys, values, arrays, objects) and optional whitespace (spaces, tabs, newlines) that humans use for readability. JSON parsers ignore all whitespace outside of strings, so it can be removed without changing the data. JSON minification strips all such whitespace, collapsing a multi-line formatted document into a single continuous line. This is beneficial when JSON is transmitted over a network because smaller payloads mean lower latency and reduced bandwidth. On a typical formatted API response, minification reduces size by 20–40%.
How does the minifier work?
The tool parses the JSON input into an internal tree of objects, arrays, strings, numbers, booleans, and null values. It then serializes the tree back to JSON without any whitespace between tokens. Strings are preserved exactly, including any internal whitespace, because altering string content would change the data. If the input contains JSON5-style comments (// or /* */), they are stripped before parsing since they are not part of the JSON standard. The tool validates the JSON during parsing and reports a specific error if the input is malformed.
Typical Use Cases
- Reducing REST API response payload sizes to improve transfer speed
- Compacting configuration or manifest files before embedding them in build artifacts
- Stripping formatting from JSON before hashing it for content integrity checks
- Removing JSON5 comments from a config file before passing it to a strict JSON parser
Step-by-step Guide
- Step 1: Paste your formatted or JSON5-style JSON into the input area.
- Step 2: Click 'Minify' to produce the compact single-line output.
- Step 3: Review the byte-size reduction shown by the tool.
- Step 4: Copy the minified JSON or download it as a file.
Example
Input
{
"name": "Alice",
"age": 30
}
Output
{"name":"Alice","age":30}
Tips & Notes
- Combine JSON minification with gzip or Brotli compression on your server; the two techniques complement each other for maximum savings.
- Do not minify JSON configuration files that developers need to read and edit directly – keep formatted versions as the source of truth.
- Use the JSON Formatter (json-format) to reverse the process and restore readability for inspection or debugging.
Frequently Asked Questions
Does minifying change the data?
No. Only whitespace outside of string values is removed. Key names, string values, numbers, booleans, null, and the structural tokens ({, }, [, ], :, ,) are preserved exactly.
Can I minify JSON with comments?
Standard JSON does not allow comments. However, the tool can strip JSON5-style // and /* */ comments before minifying, making it compatible with JSONC (JSON with Comments) used by VS Code configuration files.
What is the difference between JSON minification and JSON compression?
Minification removes whitespace at the text level and is done before the file is sent. Compression (gzip, Brotli) is applied at the transport level by the server and decompressed by the browser. Both can be applied together: minify first, then compress.
JSON Minifier
Compress and minify JSON strings by removing unnecessary whitespace and line breaks — with size comparison and savings display.
Open Tool