Text UtilitiesText FormattersFree Tool

JSON Minifier

Compress JSON to its smallest valid form by removing all whitespace, using the native JSON parser.

How to Use JSON Minifier
  1. 1Paste your JSON
  2. 2Click Convert
  3. 3Copy the minified single-line output
About JSON Minifier

What it does

The tool parses your JSON with the browser's built-in parser and writes it back out with no spaces or line breaks. Invalid input shows the parser's error message rather than output, which makes the tool a quick validity check as well.

Example

A pretty-printed object with indentation and newlines becomes a single line such as {"name":"Ana","tags":["a","b"]}. The data is identical; only whitespace is removed, which usually cuts size noticeably for deeply indented files.

Behaviours to be aware of

  • Strict JSON only. Comments, trailing commas and single-quoted strings are rejected.
  • Large integers lose precision. Numbers beyond 9,007,199,254,740,991 are rounded because JavaScript stores numbers as floating point. If you handle 64-bit IDs, keep them as strings.
  • Duplicate keys collapse to the last value.
  • Key order follows JavaScript object rules, so keys that look like whole numbers ("2", "10") are placed first in ascending order.

To make it readable again, use the JSON formatter.

Frequently Asked Questions

It parses your input with JSON.parse(), then re-serializes it with no indentation — producing the most compact valid representation.

It shows 'Invalid JSON:' followed by the exact parser error, rather than attempting to minify broken syntax.

Yes — Formatter expands with 2-space indentation, Minifier compresses to one line. Both use the same real JSON.parse/stringify approach.

No — minification happens entirely in your browser.

Related Tools

Related Articles

More from Text Utilities