How to Minify JSON Online

Paste your JSON to remove all whitespace. Minified JSON is smaller for network transfer. Minification strips spaces, tabs, and newlines from JSON while preserving the data exactly. This typically reduces file size by 10-30%, improving API response times and reducing bandwidth.

Before and After

Pretty (128 bytes)

{
  "name": "Alice",
  "age": 30,
  "hobbies": [
    "reading",
    "coding"
  ]
}

Minified (54 bytes, 58% smaller)

{"name":"Alice","age":30,"hobbies":["reading","coding"]}

How to Minify

JavaScript

const minified = JSON.stringify(JSON.parse(prettyJson));
// No spaces, no newlines

Command Line (jq)

jq -c '.' data.json > data.min.json

Python

import json
with open('data.json') as f:
    data = json.load(f)
minified = json.dumps(data, separators=(',', ':'))

When to Minify

Note: Most HTTP servers support gzip/brotli compression, which often makes minification less impactful. But both together provide the best compression ratio.

Try It Yourself

Use our JSON Minifier to compress JSON instantly, or our JSON Formatter to expand it.

Built by Michael Lip. 100% client-side — no data leaves your browser.