Minify JSON

Compact valid JSON by removing insignificant formatting whitespace.

freeworks offlinenothing uploaded
ToolJSON Minify
Input
Output
Put this on your own site

The frame below runs the same code as this page, in the reader's own browser. Nothing is sent to us, and nothing is sent to you.

Pick a dark background and the text and panels follow it, so the frame stays readable on a dark page.

Preview

How it works

The text is parsed and serialized without indentation, removing formatting whitespace while preserving strings, numbers, object members, and array order. Size reduction is calculated from the original and compact text lengths.

  • Compact serialization suits transport and storage.
  • Parsing first rejects malformed input instead of using unsafe regex removal.

Worked example

Compact Object
Remove all whitespace from a formatted JSON object
Input
											{
  "name": "Alice",
  "age": 30,
  "active": true
}
										
Output
												{"name":"Alice","age":30,"active":true}
											

When to use this

Web bundles, API request bodies, and cache values use compact JSON.

Edge cases

  • Spaces inside quoted strings remain because they are data.
  • Escaped newlines inside strings remain as escapes.
  • Malformed JSON fails instead of being silently compacted.

References