Command Palette

Search for a command to run...

JS

JSON Minifier

Minify JSON by removing whitespace, or beautify it with clean indentation, with live size-savings stats and exact parser error messages

What is a JSON Minifier?

A JSON minifier removes every space, tab, and line break that sits between the tokens of a JSON document, leaving the smallest byte-for-byte equivalent that still parses. The data itself is unchanged - the same keys, the same values, the same order - but a pretty-printed 4 KB config can drop to 2.5 KB or less once the indentation is gone. Smaller JSON means faster network transfers, lower bandwidth bills, and quicker parsing on the receiving end, which is why API responses and bundled data files are almost always shipped minified.

This minifier strips whitespace only outside string literals, so text inside your values - including spaces you meant to keep - is preserved exactly. It also keeps your numeric tokens as written: a trailing-zero value like 1.0 or a 30-digit integer survives intact, because the tool removes whitespace rather than round-tripping every number through a parse that would rewrite it. Before minifying, it validates the input with the JavaScript JSON parser, so if a comma or bracket is out of place you get the parser's exact error instead of silently broken output. A beautify mode does the reverse, re-indenting compact JSON with two spaces, four spaces, or tabs so you can read and edit it.

A worked example shows what this JSON minifier online does and does not touch. Paste a five-line object, indented with two spaces, holding "id": 12345678901234567890, "price": 1.0 and "note": "keep two spaces", then click Minify. The output is {"id":12345678901234567890,"price":1.0,"note":"keep two spaces"} and the size badge reads 78 B to 65 B, a 16.7% cut. The 20-digit id, the 1.0 and the double space inside the string all come through unchanged. Beautify is different, as the FAQ below explains.

Everything runs client-side in your browser. Your JSON - which often holds API keys, customer records, or internal configuration - is never uploaded or stored, and the tool works offline once the page has loaded. That makes it safe to minify sensitive payloads that should never leave your machine.

How to use the JSON Minifier?

  1. Paste your JSON

    Paste or type a JSON object or array into the input area. It can be pretty-printed or already compact - either works.

  2. Minify or beautify

    Click Minify to strip whitespace and shrink the file, or Beautify to re-indent it. Choose 2 spaces, 4 spaces, or tabs for beautify.

  3. Check the savings

    Read the size badge to see the original size, the new size, and the percentage reduction. Invalid JSON is flagged with the exact parser error.

  4. Copy or download

    Copy the result to your clipboard or download it as a .json file, ready to drop into your API, config, or bundle.

Key Features

  • Whitespace-Only Minify

    Removes spaces, tabs, and newlines between tokens while leaving string contents untouched, producing the smallest valid equivalent

  • Number Precision Preserved

    Keeps numeric tokens exactly as written - trailing zeros and large integers survive, because minify strips whitespace rather than reparsing values

  • Live Size Savings

    Shows original size, minified size, and the percentage reduction so you can see the byte impact immediately

  • Beautify With Your Indent

    Re-indent compact JSON with two spaces, four spaces, or tabs to make it readable and diff-friendly again

Frequently Asked Questions

Paste your JSON into the input area and click Minify. The tool removes all whitespace outside string values and shows the compressed result along with the size savings. Everything runs in your browser - nothing is uploaded.

Comments

0 comments

0/2000 characters

No comments yet. Be the first to share your thoughts!

json minifierminify jsonjson minifycompress jsonjson compressorjson formatter minifyjson beautifierminify json onlinejson whitespace removerjson minifier online