325Tools

JSON Minifier — Compress JSON to One Line Online

Strip every space, line break, and indent from JSON to shrink it to a single compact line, and see exactly how many bytes you saved. Lossless compression for smaller payloads.

Loading tool…

Examples

Collapse pretty JSON to one line
Input
{
  "id": 42,
  "tags": ["a", "b"],
  "active": true
}
Output
{"id":42,"tags":["a","b"],"active":true}

53 bytes down to 40 — the data is identical, only the whitespace is gone.

How to use this tool

  1. Paste your JSON into the input box.
  2. Click Minify JSON.
  3. Review the smaller output and size saved.
  4. Copy or download the minified JSON.

What is JSON Minifier?

JSON Minifier parses your JSON and re-serializes it with no insignificant whitespace — no indentation, no line breaks, and no spaces between tokens — collapsing it onto one line. The result is byte-for-byte equivalent data, just smaller on the wire, which is why APIs and config bundles ship minified. Because it parses first, invalid JSON is rejected with an error rather than mangled, and the size before and after is shown so you can see the saving.

Specifications

StandardRFC 8259 / ECMA-404 JSON
OperationLossless — removes only insignificant whitespace
ValidationParses first; invalid JSON is rejected
OutputSingle line, no spaces between tokens

Tips & gotchas

  • Minifying is lossless — it only removes whitespace, so values, types, and key order are unchanged and you can format it again later.
  • Minify right before sending JSON over the wire; keep a pretty-printed copy for humans to read and review.
  • Pair this with the JSON Formatter: minify to ship, format to debug — they are exact inverses.
  • Whitespace inside string values is preserved; only the whitespace between tokens is stripped, so "a b" stays "a b".

Features

  • Remove all insignificant whitespace from JSON
  • Validate JSON before minifying
  • See the size reduction in bytes
  • Copy the minified output
  • Download the result as a .json file

When to use it

  • Shrinking a JSON request or response body to send fewer bytes over the network.
  • Packing a config object into a single-line environment variable or query parameter.
  • Embedding a JSON blob inline in code or a data attribute where line breaks are awkward.
  • Reducing the size of a JSON file before committing or bundling it.

This tool runs in your browser. Your files and text are not uploaded to our servers, and we do not store your input.

Frequently asked questions

Does minifying change my data?+

No. It is lossless — only whitespace between tokens is removed. Values, types, and key order stay exactly the same, so it can be re-formatted with no loss.

How much smaller will my JSON get?+

It depends on how much it was indented; heavily nested, pretty-printed JSON often shrinks 20–50%. The tool shows the before and after byte sizes so you can see the exact saving.

Will it tell me if my JSON is broken?+

Yes. The input is parsed first, so invalid JSON produces an error message instead of garbled output. Fix the syntax and minify again.

How do I make minified JSON readable again?+

Run it through the JSON Formatter. Formatting and minifying are exact inverses, so you can switch between a compact and a readable form at any time.

Related tools

Related guides

Looking for more Developer Tools?

Browse the full collection of free, browser-based tools.