JSON Tools

JSON Minifier

Remove insignificant whitespace from valid JSON to get a compact representation for fixtures, requests, or files where readability is less important than size. The data is parsed and serialized locally.

✓ Every tool runs in your browser. We do not upload your input or output.

JSON Minifier
Keyboard shortcuts

Ctrl/⌘ + Enter: process

Ctrl/⌘ + Shift + F: full screen

Esc: exit full screen

Ctrl/⌘ + F in editor: search

Minified JSON
ReadyLines: 1 · Characters: 0 · Size: 0 KB · Time: — · Cursor: 1:1

How to use

  1. Paste or upload the JSON you want to compress, or load the sample.
  2. The tool validates the input and removes whitespace outside string values automatically.
  3. If a syntax error appears, correct it at the reported line and column before continuing.
  4. Copy the compact result or download a .json file.

Examples

Compact a response

Line breaks and indentation disappear, while the boolean and number remain unchanged.

Input
{
  "ok": true,
  "count": 3
}
Output
{"ok":true,"count":3}

Preserve spaces inside a string

The space inside the message is data and remains in the output.

Input
{"message": "hello world"}
Output
{"message":"hello world"}

When a compact form is useful

Minified JSON is convenient for small embedded fixtures, one-line examples, and payloads that will be transported or stored without human editing. It can reduce bytes when the source has lots of indentation. For production web traffic, HTTP compression is usually more effective, but minification can still simplify a file or request body.

The tool parses the document before serializing it. This is important: a simple search-and-replace of spaces would corrupt strings such as "hello world" or escaped sequences. Parsing distinguishes meaningful characters inside strings from formatting whitespace between tokens.

Know what is preserved

The parsed data structure is preserved, including arrays, objects, booleans, nulls, and string contents. Textual details that are not semantically significant to JSON may change. For example, numeric literals can be normalized by the JavaScript JSON parser. If you need byte-for-byte preservation of a special representation, compare output with the source before using it. Use the Formatter when a teammate needs to review or edit the document.

Frequently asked questions

Does minifying change JSON values?

Whitespace outside strings is removed. Values are parsed and serialized, so numeric spelling and escape style may be normalized while the parsed data remains equivalent.

Will strings lose their spaces?

No. Spaces inside quoted strings are part of the value and remain intact.

Can it minify invalid JSON?

No. It first parses the document. Fix reported syntax errors before a compact result can be produced.

Is minification the same as compression?

No. It removes JSON formatting whitespace. Gzip or Brotli can reduce transfer size further and are usually handled by your server or CDN.

Related tools