JSON MinifierONLINE

Remove unnecessary whitespace and compare the UTF-8 size of your input and output.

JSON
{
  "project": "Something worth building",
  "version": 1,
  "isPublic": true,
  "stack": [
    "Astro",
    "TypeScript",
    "JSON"
  ],
  "settings": {
    "theme": "light",
    "indent": 2
  },
  "description": null
}
Preparing editor…
Strict JSON · RFC 8259
Your JSON stays in your browser. Core processing happens locally.
Keyboard shortcuts & workspace limits

Ctrl / ⌘ + Enter runs the primary action. Ctrl / ⌘ + F searches the focused editor. Ctrl / ⌘ + Z undoes; add Shift to redo. Tab moves focus. Esc restores the expanded workspace.

Up to 10 MiB UTF-8 input, 128 nesting levels, and 32 Mi characters of output. The tree preview shows at most 2,000 nodes with bounded text. Syntax highlighting is disabled above one million characters; documents above 250,000 characters run on request. Export before reloading: documents are kept in memory, not saved.

THE PRACTICAL GUIDE

Minify JSON without removing meaningful spaces

Minification removes spaces and line breaks that separate JSON tokens while leaving whitespace inside quoted strings alone. It makes a valid document shorter without changing its data.

When should you use it?

  • Reduce a JSON fixture or embedded payload.
  • Compare readable and compact byte sizes before transfer.
  • Copy a one-line value into a system that expects compact JSON.
WORKED EXAMPLE

Example: compact an order without changing its identifier or address

The indentation and line breaks disappear. The space in New York stays, array order stays, and the large id keeps every digit. The size panel measures the UTF-8 bytes of these two representations.

Formatted JSON
{
  "id": 9007199254740993,
  "city": "New York",
  "items": [
    { "sku": "A-12", "quantity": 2 }
  ]
}
Minified result
{"id":9007199254740993,"city":"New York","items":[{"sku":"A-12","quantity":2}]}

What changes when JSON becomes one line?

JSON permits spaces, tabs, carriage returns, and line feeds between tokens. A minifier removes that optional layout. Characters inside a quoted string remain data: the space in "New York" and the escape in "line\nnext" must survive. Removing whitespace with a regular expression can corrupt those values, so this tool first parses strict JSON and writes its original tokens without structural whitespace.

The operation preserves member order, duplicate names, number notation, and string escapes. It does not shorten property names, delete empty values, or repair invalid JSON. A document that is already compact may show no reduction.

How much smaller will a minified JSON file be?

The saving depends on the input. An indented array with thousands of short records has more removable layout than a document dominated by long strings. Compare UTF-8 byte counts for your actual document instead of relying on a fixed percentage. Non-ASCII text can occupy several bytes per character, so character count alone does not measure the file size.

Minification and HTTP compression are separate operations. This page returns readable JSON text with compact layout; gzip and Brotli create compressed byte streams at the transport or file layer. Measure the compressed response in your own server setup if transfer size is the goal. Keep an indented source copy when people will maintain the file in version control.

AT THE WORKBENCH

Fewer bytes. The same values.

Minification removes spaces and line breaks between JSON tokens. It keeps meaningful spaces within strings and preserves the exact spelling of every number.

  1. Start with valid JSON

    Invalid input is reported, never silently repaired.

  2. Remove structural whitespace

    Minify without changing strings, keys, or array order.

  3. Compare and download

    See the UTF-8 byte sizes and the percentage removed.

IN PRACTICE

How do I remove JSON whitespace without changing spaces inside strings?

Run Minifier on a valid document. It removes spaces, tabs, and line breaks between JSON tokens while leaving quoted string content alone. Compare UTF-8 byte counts afterward to see the actual saving for this input; the percentage depends on how much optional whitespace it contained.

JSON: a space inside a value is data

json
{
  "city": "New York",
  "count": 3
}

The compact result is {"city":"New York","count":3}. The space in “New York” remains because it is inside a string value.

No. Minification removes optional characters in the document. A transport compressor such as gzip works on the resulting bytes and may achieve a different saving. The tool reports the uncompressed UTF-8 size of its own input and output.

BEFORE YOU USE THE RESULT

What should you check before using the result?

A smaller text document is not the same as compressed transport. HTTP gzip or Brotli can produce a different saving. Minification cannot fix invalid JSON.

Minification is not compression

Minification changes the JSON text by removing optional whitespace. Transport compression such as gzip or Brotli is separate and can reduce transferred bytes further. The size comparison here measures uncompressed UTF-8 text.

When nothing gets smaller

An already compact document may show no savings. Whitespace within string values must remain: removing it would change the data. You can return to the formatter whenever you need a readable copy.

Understand JSON syntax

Technical reference: JSON syntax and interoperability · RFC 8259

THE JSON FIELD GUIDE
All guides