Minify JSON
Minify and compress JSON by removing all whitespace. Reduces file size while keeping data intact. 100% client-side.
Paste formatted JSON, hit Minify, and get a single compact line with all unnecessary whitespace stripped out — tabs, newlines, indentation, gone. The stats panel shows the exact byte difference so you know how much space you saved before shipping. And everything runs in your browser. Nothing gets uploaded.
How It Works
The minifier parses your JSON into a native JavaScript object using JSON.parse(), then serializes it back with JSON.stringify() — no spaces, no newlines, no indentation. This approach also validates your JSON in the process. If parsing fails, you'll see the exact error so you can fix it before minifying.
Examples
Simple User Object
Cleaning up a formatted API response before embedding it in a script tag.
{
"name": "Alice",
"age": 29,
"active": true
}
{"name":"Alice","age":29,"active":true}
Nested Config File
A typical app config with nested objects and arrays — the kind that balloons in size when pretty-printed with 4-space tabs.
{
"database": {
"host": "db.example.com",
"port": 5432,
"credentials": {
"user": "admin",
"pass": "s3cret"
}
},
"features": [
"auth",
"logging",
"cache"
]
}
{"database":{"host":"db.example.com","port":5432,"credentials":{"user":"admin","pass":"s3cret"}},"features":["auth","logging","cache"]}
Array of Products
Shrinking a product catalog export before sending it through a webhook with a 1MB payload limit.
[
{
"id": 101,
"name": "Widget",
"price": 9.99
},
{
"id": 102,
"name": "Gadget",
"price": 24.50
}
]
[{"id":101,"name":"Widget","price":9.99},{"id":102,"name":"Gadget","price":24.50}]
Who Uses This
Shrink JSON payloads before storing them in environment variables or embedding in build scripts.
Compress config files and CI/CD pipeline definitions to stay under size limits.
Minify exported datasets before uploading to APIs with strict payload caps.
Inline JSON into HTML or JS bundles without inflating the page size.
Common Mistakes
If your JSON has a trailing comma or unquoted keys, the parser will reject it. Fix the syntax errors first — this tool will show you exactly where the problem is.
Spaces inside string values (like "New York") are real data, not formatting. Minification won't touch them. Only whitespace between keys and brackets gets removed.
JavaScript objects can have unquoted keys like { name: "Alice" }. That is not valid JSON — keys must be double-quoted. Wrap them in quotes before minifying.
Technical Details
- Processing: 100% client-side — nothing is uploaded
- Browser Support: Chrome, Firefox, Safari, Edge
- Max Input: Limited only by your browser's available memory
- Validation: Automatically checks JSON syntax before minifying
Frequently Asked Questions
What does minifying JSON actually do?
It strips out every space, tab, and line break that exists only for readability. Your data stays identical — same keys, same values, same structure. The only difference is it's one continuous line instead of a nicely indented block.
How much smaller will my JSON get?
Depends on how heavily formatted the original is. A file with 4-space indentation and 5 levels of nesting can shrink 30-50%. Flat, already-compact JSON might only drop a few percent. The stats panel shows you the exact before-and-after byte count.
Is my JSON sent to a server?
No. The entire process happens in your browser's JavaScript engine. Nothing gets uploaded, stored, or transmitted. You can disconnect from the internet and it still works.
Can I minify JSON with comments?
Standard JSON doesn't support comments — the spec forbids them. If your file has // or /* */ comments (common in JSON5 or JSONC config files), you need to strip those out first. Otherwise the parser will throw an error.
What's the difference between minify and compress?
Minifying removes unnecessary characters while keeping the output readable as text. Compression (like gzip or brotli) turns the text into binary data that is much smaller but can't be read directly. For the best results, minify first and then compress — you will get the smallest possible file.