Skip to content

JSON Minifier

Shrink JSON to a single line for embeds, QR payloads, or size-limited cookies. This page highlights Minify — invalid JSON is caught before compression.

Loading tool…

How to use JSON Minifier

  1. 1. Paste valid JSON. Fix errors first, or click Repair for trailing commas and similar issues.
  2. 2. Click Minify. Output becomes one line with no extra spaces.
  3. 3. Copy the result. Use in production configs or network requests where bytes matter.

About this tool

Minifying removes insignificant whitespace. Semantic content stays identical, which is why minify is safe after validation. This URL is for the “json minifier” query specifically.

Minify vs gzip

Transport compression already shrinks pretty JSON on the wire. Minify still helps when the JSON itself is stored in a database row, URL, or embedded script tag with a hard size cap.

Code examples

JavaScript

const payload = JSON.parse(raw);
console.log(JSON.stringify(payload, null, 2));

Python

import json
print(json.dumps(json.loads(raw), indent=2, sort_keys=True))

Go

var buf bytes.Buffer
if err := json.Indent(&buf, []byte(raw), "", "  "); err != nil {
  log.Fatal(err)
}

This is one direction of the shared converter. The editor is the same; the title and default direction match this search.

Frequently asked questions

Related tools

All tools