Input

Input is empty.

Minified Output

Minified JSON appears here

Paste or type JSON in the panel on the left and the whitespace comes out as you go.

How Much Whitespace Is Actually in There

Minifying JSON is not a clever transformation. It parses the document, serialises it again with no indent argument, and every space, tab and newline that existed only for your benefit disappears. That is safe because the grammar says so: RFC 8259 §2 permits whitespace between any two tokens and gives it no meaning, which is exactly why it can all be deleted, and why the same is emphatically not true of YAML, where indentation is the structure. What is worth knowing is how much stripping it buys, because the numbers repeated around the web, "up to 70% smaller", describe a file that was mostly indentation, and most files are not.

Take the Call Detail Record in the example below. Pretty-printed at two spaces it is 328 bytes over 20 lines; minified it is 213 bytes on one line. That is a 35.1% reduction, and it is high rather than typical, because the record is five levels deep and its keys are short: indentation cost is driven by nesting depth, not by how much data you have. Flatten the same record into six top-level keys and the saving falls to about 14%. Nothing is wrong in either case; the ratio is just a fact about shape.

The honest caveat, and the reason to be sceptical of the 70% figure: if the document travels over HTTP it is almost certainly gzipped, and gzip is extremely good at repeated runs of spaces. The same record compresses to 201 bytes pretty-printed and 171 bytes minified, so minifying saved 115 raw bytes but only 30 on the wire, about 15%. Minify because a compact payload is easier to log, embed and store, not because you are expecting a bandwidth win that HTTP compression has usually already taken.

Minifying a Document

  1. Paste or upload one file – Type into the input editor, press "Paste" to take whatever text is on your clipboard, or press "Upload" to load one .json or .txt file. The upload is shown indented on the left so you can still read what you are about to squash. It handles a single file per load; there is no batch mode.
  2. Read the right panel and the strip under it – Each pause in typing triggers a fresh minify after 300 ms. The strip under the output gives the byte count and the saving; for the Sample it reads "141 B · 36 B smaller (20.3%) · keys as written". Broken input brings up the invalid-JSON panel, an amber band on the failing line and a clickable line and column, and the right pane never shows a partly stripped document.
  3. Sort first, if you want a canonical copy – With "Sort keys A to Z" pressed, keys get alphabetised in every object, nested ones included, before the whitespace comes out. The Sample then starts {"age":30,"city":"Reykjavik",… instead of with "name". Arrays keep their order.
  4. Check the values, not just the length – Number literals are copied across character for character, so a 19-digit ICCID keeps all 19 digits, 1.50 stays 1.50 and 1e5 stays 1e5. Only the whitespace between tokens changes.
  5. Copy or download – "Copy" puts the single line on your clipboard; "Download" saves it as minified.json. Both read the output pane, so what you get is what you can see.

Pro Tip: Minify last, not first. A minified file is unreadable in a diff, so keep the formatted copy in version control and minify on the way out: the JSON Formatter reverses this exactly, and the round trip is safe in both directions.

Example

A Call Detail Record with two handover entries, at the two-space indentation almost every tool emits. Both blocks below are real output, not typed by hand: 328 bytes across 20 lines becomes 213 bytes on one line. That is 115 bytes saved, or 35.1%: high for a JSON document, and it is the nesting that earns it.

Formatted → Minified 328 B → 213 B
cdr.jsonJSON · 20 lines · 328 B
{
  "cdrId": "CDR-2026-06-24-0001",
  "msisdn": "447700900142",
  "durationSec": 187,
  "chargeable": true,
  "radio": {
    "cellId": "AB12-3CF",
    "rsrp": -92,
    "handovers": [
      {
        "cellId": "AB12-9D1",
        "atSec": 74
      },
      {
        "cellId": "AB13-1A0",
        "atSec": 151
      }
    ]
  }
}
cdr.min.jsonJSON · 1 line · 213 B
{"cdrId":"CDR-2026-06-24-0001","msisdn":"447700900142","durationSec":187,"chargeable":true,"radio":{"cellId":"AB12-3CF","rsrp":-92,"handovers":[{"cellId":"AB12-9D1","atSec":74},{"cellId":"AB13-1A0","atSec":151}]}}

Common Use Cases

Embedding a document in something else

A config blob going into an environment variable, a fixture pasted into a test, a payload that has to sit on one line inside a log entry: all of these break or read badly when the JSON carries newlines. Minifying is the fix, and here the saving is beside the point: what you wanted was one line. Pair it with the JSON Escape tool when the destination is itself a JSON string.

Trimming what you store, not what you send

Whitespace in a database column, an object-store key or a message queue payload is stored and paid for verbatim, often without compression in front of it. That is where the 35% in the example above is a genuine 35%. Over HTTP, where gzip or brotli is doing most of the work already, expect closer to 15%.

Making two files comparable

Two services claim to emit the same document but one indents with four spaces and the other with tabs, so a byte comparison is useless. Minify both and the difference that remains is a real difference: the token sequence the JSON grammar actually defines, with the cosmetic layer taken off. For the field-by-field answer, take them to JSON Diff.

Worth Knowing

  • It validates before it minifies – A document that does not parse produces the error panel with a line and column, never a partially stripped output. There is no way to get half a result out of this page.
  • Long integers survive – Number literals are read out of your source text rather than converted to JavaScript numbers, so 8901240544102066246 stays exact instead of rounding to 8901240544102066000 the way a plain JSON.parse round trip does.
  • Numbers and key order come out as written – The input is never turned into JavaScript numbers or objects, so 1.50, 1e5 and -0 keep their exact text and a key such as "3" stays where it was instead of jumping ahead of "20". Strip the whitespace from both sides and a hand-written file diffs cleanly against its minified copy.
  • Duplicate keys collapse – JSON permits them and every parser keeps the last, so {"a":1,"a":2} minifies to {"a":2} with no warning. Worth checking if your input was assembled by string concatenation.
  • One file at a time – Upload takes a single file. There is no batch queue and no folder mode, for a directory of documents, a shell loop over your own JSON tooling is the right instrument.
  • Nothing is uploaded – Parsing and serialising both run in this tab. Load the page, disconnect, and it still works.

Frequently Asked Questions

Does minifying change my data?

No, apart from the whitespace. A minifier built on JSON.stringify re-prints every number in its shortest form, so 1.50 turns into 1.5, 1e5 into 100000 and 8901240544102066246 into 8901240544102066000, and it moves keys that look like array indices to the front. This page reads the tokens straight out of your text instead: {"price": 1.50, "rate": 1e5, "iccid": 8901240544102066246, "20": 1, "3": 2} comes out as {"price":1.50,"rate":1e5,"iccid":8901240544102066246,"20":1,"3":2}, character for character. Two things do change, both on purpose: a duplicated key keeps only its last value, the way every parser reads it, and pressing Sort keys A to Z alphabetises them.

How much smaller will my file get?

Measure it rather than trusting a headline. The example on this page is 35.1%, and that is on the generous side because the document is deeply nested with short keys. A flat record of the same size gives about 14%. Long string values dilute the ratio further: a payload that is mostly prose barely moves, because there was hardly any whitespace in it to begin with. The one reliable rule: saving tracks nesting depth, not file size.

Is it worth minifying if my server already gzips?

Usually not for bandwidth. Measured on the example document, gzip takes the formatted copy to 201 bytes and the minified copy to 171: the minifying step is worth about 15% once compression has done its work, because runs of identical spaces are the easiest thing a compressor will ever meet. It is still worth doing when the file is being stored uncompressed, embedded in another document, or written to a log.

Can I minify invalid JSON?

No, and that is deliberate: stripping whitespace from a document you have not parsed can change what it means. Fix the input first: the error panel gives you a line and column, the JSON Validator explains it in more detail, and Stack Overflow's JSON tag covers the unusual ones.

Does anything leave my browser?

No. The document is parsed and re-serialised by code in this tab; nothing is sent, stored or logged, and a file you pick with Upload is read locally and discarded when you close the tab. "Paste" looks at your clipboard once, when you press it, and puts the text in the input pane.

Related Tools