Tools

Home
JSON FormatterSQL FormatterJS ValidatorMinify CSS
Merge PDFCompress PDFImage to PDF
JPG to PNGPNG to WebPCrop Image

Minify JSON

Minify and compress JSON by removing all whitespace. Reduces file size while keeping data intact. 100% client-side.

Your files never leave your browser
JSON Input0 chars, 0 lines
Minified Output0 chars, 0 lines
Error:
    Ready·

    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

    Paste JSON
    ➔
    Parse & Strip Whitespace
    ➔
    Compact Output

    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.

    INPUT
    { "name": "Alice", "age": 29, "active": true }
    OUTPUT
    {"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.

    INPUT
    { "database": { "host": "db.example.com", "port": 5432, "credentials": { "user": "admin", "pass": "s3cret" } }, "features": [ "auth", "logging", "cache" ] }
    OUTPUT
    {"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.

    INPUT
    [ { "id": 101, "name": "Widget", "price": 9.99 }, { "id": 102, "name": "Gadget", "price": 24.50 } ]
    OUTPUT
    [{"id":101,"name":"Widget","price":9.99},{"id":102,"name":"Gadget","price":24.50}]

    Who Uses This

    👨‍💻 Developers

    Shrink JSON payloads before storing them in environment variables or embedding in build scripts.

    🚀 DevOps Engineers

    Compress config files and CI/CD pipeline definitions to stay under size limits.

    📊 Data Analysts

    Minify exported datasets before uploading to APIs with strict payload caps.

    🎨 Frontend Devs

    Inline JSON into HTML or JS bundles without inflating the page size.

    Common Mistakes

    Minifying invalid JSON

    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.

    Expecting strings inside values to change

    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.

    Pasting a JavaScript object instead of JSON

    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

    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.

    Share: