JSON Minify — Compress and Minify JSON Online

🔒 Runs in your browser — nothing is sent to a server

JSON minify any pretty-printed or indented JSON into the smallest valid representation in a single click. Paste a multi-line API response, a config file or any blob with whitespace, and this JSON minifier validates the syntax and emits a single-line, whitespace-free version with no spaces around colons, no line breaks between keys and no padding inside arrays. Errors point at the offending position so malformed JSON never gets silently mangled. Everything runs 100% inside your browser; your input never leaves your device, nothing is uploaded, logged or sent to any server.

Copied!

When to use a JSON minifier

You reach for a JSON minifier any time a JSON document needs to travel across a constrained channel: an HTTP API response where every kilobyte counts toward CDN bills, a Postgres `jsonb` column where the storage layout pads what you write, a query string that has a hard length cap, a webhook delivery where the receiver charges per request body byte, or a build step that bakes JSON into a JavaScript bundle whose size affects Lighthouse scores. Browser-local minification means the payload never touches a server during the transform — important when the JSON contains secrets, tokens or PII you would rather not leak to a remote tool.

How JSON minifying works under the hood

JSON minifying is a two-step pipeline. First the input string is parsed into an in-memory JavaScript value through `JSON.parse` — this step also validates the syntax, so any error here surfaces immediately as a clear "Unexpected token" message with a position. Second, that value is serialised back to a string with `JSON.stringify(value)`, called with no second or third argument. Without an indent argument, the runtime emits the document on a single line with no spaces between tokens — the smallest valid representation. The original semantics are preserved exactly: keys keep their order, numbers their precision, strings their escapes. The whole pipeline runs natively inside the browser engine, so a multi-megabyte JSON document minifies in milliseconds without leaving your tab.

Examples

Input
{
  "id": 42,
  "user": "alice@free-converter.online",
  "roles": [
    "admin",
    "auditor"
  ]
}
Output
{"id":42,"user":"alice@free-converter.online","roles":["admin","auditor"]}
JSON minify — pretty-printed API response into one line
Input
{
  "products": [
    { "sku": "FC-001", "price": 29.99 },
    { "sku": "FC-002", "price": 49 }
  ],
  "total": 2
}
Output
{"products":[{"sku":"FC-001","price":29.99},{"sku":"FC-002","price":49}],"total":2}
Compress JSON — products array with prices into compact form
Input
{
  "tool": "json minify",
  "useCase": "compress json for transport",
  "online": true
}
Output
{"tool":"json minify","useCase":"compress json for transport","online":true}
Remove whitespace JSON — payload that names the tool itself
Input
[
  1,
  "two",
  true,
  null,
  { "three": 3 }
]
Output
[1,"two",true,null,{"three":3}]
Minify JSON online — array with mixed JSON types

FAQ

How do I minify a JSON string?

Paste the formatted or indented JSON into the input above and click Minify. The JSON minifier parses your input via the browser's native `JSON.parse`, then re-emits it with `JSON.stringify(value)` — no indent argument, so every byte of optional whitespace is stripped. If the input is invalid, the parser's error message surfaces at the offending position instead of mangled output.

What is JSON minification?

JSON minification rewrites a JSON document with every byte of optional whitespace removed: no line breaks between keys, no spaces after colons or commas, no indentation, the entire structure on a single line. The data is unchanged — same keys, same values, same nesting — only the formatting differs. Minified JSON is the smallest valid representation of any given object.

Why should I compress JSON before sending it over the network?

Minified JSON is typically 20–40% smaller than its pretty-printed equivalent. Over an HTTP API serving thousands of requests per second, that translates directly into less bandwidth, lower CDN egress bills, faster time-to-first-byte and lower mobile data costs. Most API frameworks default to compact output for exactly this reason; gzip on top compounds the saving further.

How do I minify JSON in JavaScript or Python?

In JavaScript, `JSON.stringify(value)` with no second or third argument produces fully minified JSON. In Python, `json.dumps(value, separators=(",", ":"))` emits the same compact form (the default `json.dumps` adds a space after each comma). Both produce identical output to this online JSON minifier; the browser tool is just a UI layer on top.

Will minifying my JSON change the data inside it?

No. JSON whitespace outside string values is never significant — the parser ignores it entirely. Minification only removes those ignorable bytes; every key, value, number, boolean and null stays exactly the same, in the same order, with the same precision. A minified document round-trips losslessly through any conformant JSON parser.

How is JSON minify different from JSON beautify?

JSON minify and JSON beautify are exact opposites. Minify strips every byte of optional whitespace to produce the shortest valid JSON for transport or storage. Beautify adds line breaks and indentation back so a human can read the document. The data is identical in both directions; only the formatting differs. Use minify for the wire, beautify for debugging.

Is it safe to paste sensitive JSON into this minifier?

Yes — the JSON minifier runs entirely in your browser using the native `JSON.parse` and `JSON.stringify` APIs. Your input and the minified output stay on your machine; nothing is uploaded, logged or cached. Safe for API responses with secrets, JWT payloads, internal config files and any blob you would not want a remote service touching.

Glossary

JSON (JavaScript Object Notation)

JSON is a lightweight, text-based data format that represents structured data as nested objects, arrays, strings, numbers, booleans and null. Defined by RFC 8259 and ECMA-404, JSON is the de-facto wire format for HTTP APIs, configuration files, package manifests and IPC. A JSON minifier removes optional whitespace from any valid JSON document without altering the data it represents.

JSON minifier

A JSON minifier is any tool or function that strips optional whitespace from a JSON document, producing the shortest valid representation of the same data. Browser `JSON.stringify(value)`, Python `json.dumps(value, separators=(",", ":"))` and most API frameworks emit minified JSON by default. Browser-local minifiers like this page have a security advantage: the JSON never leaves the tab.

Whitespace in JSON

In JSON, whitespace outside string literals is purely cosmetic — spaces, tabs, newlines and carriage returns can appear anywhere between tokens without changing the document's meaning. That is precisely what makes minification lossless: the parser ignores those bytes, so removing them yields a smaller string that decodes to the same value. Whitespace inside string values, by contrast, is preserved.

Compact JSON

Compact JSON is a synonym for minified JSON: the entire document on a single line with no spaces around colons, no line breaks between keys, no padding inside arrays. Compact JSON is what HTTP APIs ship across the wire because it is the smallest valid representation. A JSON beautifier reverses the transform when you need a readable view.

Pretty-printed JSON

Pretty-printed JSON is JSON formatted with line breaks, indentation and spaces around colons so a human can read it. Two-space indentation is the most common convention. A JSON minifier reverses the transform — strips every cosmetic byte — to produce the smallest valid form. The two representations parse to the same value because JSON whitespace outside strings is insignificant.

Related tools