Skip to main content

Minify JSON Online — Free JSON Compressor Tool

Minify JSON online for free. Remove whitespace, newlines, and indentation to reduce JSON file size by 20-40%. Instant results, no signup required.

How to Minify JSON

JSON minification removes all unnecessary whitespace, newlines, tabs, and indentation from a JSON document while keeping the data structure intact. Minified JSON is functionally identical to the original — it just uses fewer bytes. This typically reduces file size by 20–40%, which directly improves API response times, reduces bandwidth costs, and speeds up data transfer between services.

Paste your formatted JSON into the tool above. It will output the minified version on a single line with no extra whitespace. Every byte saved adds up when your API serves thousands of requests per second.

Before and After Minification

// Before: 128 bytes (formatted)
{
    \"name\": \"John Doe\",
    \"age\": 30,
    \"skills\": [
        \"JavaScript\",
        \"Python\",
        \"SQL\"
    ]
}

// After: 62 bytes (minified) — 52% smaller
{\"name\":\"John Doe\",\"age\":30,\"skills\":[\"JavaScript\",\"Python\",\"SQL\"]}

Minify JSON in Code

// JavaScript — JSON.stringify with no spacing
const minified = JSON.stringify(data);
// With formatting: JSON.stringify(data, null, 2)

// Node.js — minify a JSON file
const fs = require('fs');
const data = JSON.parse(fs.readFileSync('data.json', 'utf8'));
fs.writeFileSync('data.min.json', JSON.stringify(data));

# Python
import json
minified = json.dumps(data, separators=(',', ':'))
# Default: json.dumps(data, indent=2)

When to Minify JSON

  • API responses: Serve minified JSON to reduce payload size and latency. Most frameworks do this by default in production mode.
  • Configuration files: Minify JSON configs in Docker images and deployments to reduce image size.
  • Local storage: Minify JSON stored in browser localStorage or sessionStorage to stay within the 5-10 MB limit.
  • Logging: Log minified JSON to reduce disk I/O and storage costs at scale.

Minification vs Compression

Minification and compression (GZIP/Brotli) are complementary. Minification removes structural whitespace from the source. Compression uses algorithms to reduce the encoded size further. For best results, minify your JSON then serve it with GZIP or Brotli compression enabled on your web server — this typically achieves 85-95% total size reduction.

Try JSON Validator & Beautifier Free

Validate, format, and beautify JSON data.

Use JSON Validator & Beautifier →