JSON Minifier
Strips all whitespace from JSON and compresses it to a single minified line, reducing payload size for APIs and storage. After minifying, the tool reports exact byte savings so you can see the percentage reduction at a glance. Everything runs locally in your browser — no files are uploaded and no server is involved.
JSON
Minified JSON
What is JSON Minifier & Compressor?
Pretty-printed JSON is for humans. The indentation, newlines, and spaces that make it readable add bytes that add latency. A typical API response formatted with 2-space indentation is 20–40% larger than its minified equivalent — bytes that every mobile client on a slow connection pays for. This tool strips all insignificant whitespace from a JSON document: spaces between tokens, newlines, and indentation, without altering any string values, numbers, or structural characters. The result is a single-line, maximum-density JSON string. Enable key sorting to produce alphabetically ordered output — useful for generating consistent cache keys, reproducible checksums, and signatures where two semantically identical objects should always produce the same byte sequence. Lenient mode accepts JSON with comments and trailing commas (as used in tsconfig.json and .eslintrc), converting it to strict RFC 8259 output for embedding or transmission.
How to Use
- 1
Paste Your JSON
Paste pretty-printed, indented, or otherwise expanded JSON into the input panel. The minifier accepts valid JSON in any whitespace format.
- 2
Set Minification Options
Toggle "Remove Comments" if using JSON5-style input, choose whether to sort keys for deterministic output, and set the target line length for multi-line compact mode.
- 3
Minify the JSON
Click "Minify". All whitespace between tokens (spaces, newlines, tabs) is stripped. The output is a single-line, compact JSON string with maximum whitespace reduction.
- 4
Copy the Minified JSON
Copy the compact output for embedding in an HTTP response body, environment variable, JavaScript bundle, or any context where every byte counts.
Common Use Cases
API Response Optimisation
Minify JSON API responses to reduce payload size before serving to mobile clients or low-bandwidth users, lowering data transfer costs and improving response time over cellular networks.
Bundle Size Reduction
Minify JSON config files, translation files, or data fixtures embedded in JavaScript bundles to reduce the overall bundle size and improve page load performance in production web applications.
Environment Variable Packing
Compress multi-line JSON configurations to a single line for safe storage in environment variables, CI/CD secrets managers, or .env files that do not support multi-line values.
Log Compaction
Minify structured JSON log entries before writing to log aggregation services to reduce storage costs and improve ingest throughput in high-volume logging pipelines.
Conversion Examples
Pretty JSON → Minified Single Line
All whitespace, newlines, and indentation are removed to produce compact JSON.
Input JSON
{
"server": {
"host": "localhost",
"port": 8080,
"debug": false
},
"database": {
"url": "postgres://localhost/app",
"pool": 10
}
}Output CSV
{"server":{"host":"localhost","port":8080,"debug":false},"database":{"url":"postgres://localhost/app","pool":10}}Large Array → Compressed Output
A formatted JSON array is compressed to minimise byte count for HTTP transfer.
Input JSON
[
{ "id": 1, "name": "Alice", "active": true },
{ "id": 2, "name": "Bob", "active": false },
{ "id": 3, "name": "Carol", "active": true }
]Output CSV
[{"id":1,"name":"Alice","active":true},{"id":2,"name":"Bob","active":false},{"id":3,"name":"Carol","active":true}]