JSON Minifier — Compact JSON Online

Strip whitespace from pretty JSON to shrink payloads — entirely client-side.

convert² THE BEAUTIFIER
Enter format · K copy
INDENT
Input · raw
0 B 0 ln
1
Output · formatted
0 B 0 ln
{ }
awaiting input
paste code on the left
pick a format above
Original · A
0 B
Removed raw
Added
Original · B
0 B
↓ About this tool

JSON Minifier — Compact JSON Online

Strip whitespace from pretty JSON to shrink payloads — entirely client-side.

What it does

Pretty-printed JSON is easy for humans to read, but every space and newline is wasted bytes going over the wire. Minifying strips all non-essential whitespace so the structure and values stay identical, just smaller.

Typical shrinkage is 20–40%, depending on how deeply nested your data is. For REST APIs, websocket frames or embedded JSON-in-URL (like convert2's own share links), every kilobyte counts.

How to use it

  1. Paste your pretty JSON into the left pane.
  2. The minified single-line version appears on the right, silently.
  3. Copy it, download as .json, or pipe it into the next step of your build.
  4. If the JSON is invalid, the output shows the parser error with its line and column.

Example

Input
{
  "name": "convert2",
  "version": "1.0.0",
  "active": true,
  "tags": ["tool", "formatter"]
}
Output
{"name":"convert2","version":"1.0.0","active":true,"tags":["tool","formatter"]}

Why convert2

  • Smaller payloads. 20–40% savings typical, more for deeply nested data.
  • URL-safe. Minified JSON embeds cleanly in query strings and fragments.
  • Round-trip safe. JSON.parse(minify(input)) equals JSON.parse(input) for all valid input.
  • Private. Same promise as every other convert2 tool — your data doesn't leave the tab.

Common use cases

  • Shrinking response bodies before gzip, when you control the server.
  • Packing JSON into a URL fragment for share links or deep-linking.
  • Preparing fixtures for tests where line-level diffs matter.
  • Shipping JSON inside HTML data-* attributes.

JSON Minifier specifics

  • Uses the browser's native JSON.stringify(obj) — no custom tokenizer.
  • Key order is preserved from input.
  • String contents are untouched — spaces inside string values stay.
  • For lossy minification (removing null keys, defaults, etc.) you need a schema — convert2 does not do that.

Frequently asked questions

What does minifying JSON do?

It removes all non-essential whitespace — spaces, newlines, tabs — to produce the smallest valid JSON representation. The structure and values stay identical.

Is the JSON still valid after minifying?

Yes. Minification only strips whitespace; every parser that accepts the pretty version accepts the minified version.

Do strings with spaces inside still work?

Yes. Whitespace inside string values is preserved — only structural whitespace between tokens is removed.

Other tools

copied