Digital ToolPad.

Runs 100% in your browser

Your data never leaves your device. zero uploads.

Smaller JSON, same data

JSON Minifier

Paste formatted JSON or open a .json file to compress it into a single line. The minifier removes indentation and line breaks, keeps spaces inside strings, and shows exactly how many bytes you saved. All in your browser.

How it works

Valid JSON

Loading...

144 B12 linesdepth 2Processed in your browser

What is JSON minification?

JSON minification removes whitespace that only exists for humans: indentation, line breaks and spaces between tokens. The result is a single line that parsers read exactly the same way, but with fewer bytes to store or send. Minifying JSON with 2-space indentation typically cuts its size by 20 to 30%, for example 22% on a real package-lock.json, and the saving grows with deeper nesting.

This minifier parses the JSON before writing it back on one line, so it never produces broken output and never touches the text inside strings. If the input is invalid, it tells you where and why instead of guessing.

How to minify JSON

  1. 1

    Add JSON

    Paste formatted JSON into the editor or press Open file to load a .json file.

  2. 2

    Minify

    Press Minify JSON. The editor now contains a single line, and the status shows the size before and after.

  3. 3

    Copy or download

    Copy the compact JSON or download it as a .min.json file.

  4. 4

    Need it readable again?

    Press Format to expand it back to indented JSON at any time.

Before and after

The space inside "hello world" is kept because it is part of the value. Only whitespace between tokens is removed.

Formatted and minified versions of the same JSON
VersionTextSize
Formatted (2 spaces){↵ "message": "hello world",↵ "count": 2↵}44 bytes
Minified{"message":"hello world","count":2}35 bytes

When to minify JSON

API payloads
Smaller request and response bodies, especially for mobile clients and high-volume endpoints.
Environment variables
Many platforms need JSON config on a single line, for example service account keys or feature flag sets.
Embedding in code
Paste one-line JSON into a string literal, HTML data attribute or SQL statement without breaking it.
Storage
Save space in databases, localStorage, caches and log lines that store JSON documents.

Minification vs gzip and Brotli

Minification and compression work well together but are different things. Minified JSON is still plain JSON that any parser can read. Gzip and Brotli encode bytes for transfer and must be decompressed first. Web servers usually apply them automatically, and minifying first still saves a little more and reduces parsing work.

Minification compared with transfer compression
MinificationGzip / Brotli
OutputValid JSON textBinary encoded data
Readable without toolsYesNo
Typical saving on formatted JSON20 to 30%70 to 90%
Where it happensBuild step or this toolWeb server or CDN

Minify JSON in code

One-line JSON minification commands
ToolCommand
jqjq -c . data.json
Pythonpython -c "import json,sys; print(json.dumps(json.load(sys.stdin), separators=(',', ':')))" < data.json
JavaScriptJSON.stringify(value)

JSON Minifier FAQ

Does minifying JSON remove spaces inside strings?

No. Only whitespace between tokens is removed. Text inside strings, including spaces and escaped line breaks, stays exactly as it was.

Is minified JSON still valid JSON?

Yes. It is the same data with less whitespace, and every JSON parser reads it the same way.

How much smaller will my JSON be?

It depends on the indentation and nesting. Pretty-printed JSON usually shrinks by 20 to 30%. The tool shows the exact before and after size each time you minify.

Can I minify JSON with comments or trailing commas?

No. The input must be valid JSON. The validator shows where the comment or trailing comma is so you can remove it first.

Can I un-minify JSON?

Yes. Press Format to expand minified JSON back into readable, indented text.

Is minification the same as compression?

Not quite. Minification removes whitespace and keeps JSON readable by any parser. Compression such as gzip encodes the bytes and needs decompressing. Most servers do both.

100% private: your data never leaves your browser

No registration, no tracking of your content, no server uploads. Don't just take our word for it:

  • No server, no uploads

    Your files and text are processed entirely on your device. Nothing is ever sent to us.

  • Works offline

    Once loaded, this tool keeps working with your Wi-Fi turned off. Try it.

  • Verify it yourself

    Open your browser's DevTools → Network tab. You'll see zero requests carrying your data.

Explore more tools

More utilities for your next task.

Browse all tools