Strip whitespace from JSON to make it smaller.

Output

Output will appear here
Technical details
Operation
Copies the original tokens with no whitespace; nothing is re-serialized
Use
Shrink request/response and stored payloads
Data
Unchanged: big integers, 1.0, 1e5, string escapes and key order stay exactly as written
Duplicate keys
Kept as written, with a warning
Private ● What you enter stays on your device What you enter stays on your device.No account required.Your input stays on this device (never uploaded).Clear saved input removes it.
▸ More about

Uses of JSON minification

  • Reducing the size of production API responses
  • Shrinking static JSON served over HTTP
  • Compacting config bundles in build output

JSON minification pitfalls

  • Minifying JSON stored in source control (unreadable diffs)
  • Minifying files that contain comments

JSON minification questions(10)

What does JSON minification do?

It removes all non-significant whitespace (spaces, tabs, newlines) between JSON tokens. The data is unchanged. `{ "a": 1 }` and `{"a":1}` are semantically identical; the minified version is just fewer bytes.

How much does minification reduce JSON size?

Depends on how much whitespace the formatted version has. A well-indented JSON with deep nesting might shrink 20–40%. A flat object with short keys and values might shrink by only a few percent. The savings compound when combined with gzip compression, since repetitive whitespace patterns compress well.

Is minified JSON still valid JSON?

Yes. The JSON spec says whitespace between tokens is ignored. Minified JSON is perfectly valid and parses identically to its formatted counterpart. Any compliant JSON parser handles both.

Can I format minified JSON back to readable form?

Yes. Minification is reversible. Paste the minified JSON into a formatter and it will produce the same structure with indentation. The two operations are inverses: neither re-serializes your data, both copy the original tokens and change only the whitespace, so the round-trip is lossless.

When should I minify JSON?

When you're optimizing payload size for production traffic. API responses, static JSON files served over HTTP, and config bundles in shipped code are good candidates. Development environments, config files in source control, and data you're actively debugging are not: readability matters more there.

What's the difference between minification and gzip compression?

Different layers. Minification removes whitespace at the text level. Gzip (or Brotli) applies entropy compression to the bytes of whatever text you send: including the whitespace, if it's still there. They work well together: minifying first gives the compressor a cleaner, more repetitive input, which typically improves compression ratios.

Does minification affect JSON ordering or structure?

No. Key order and value types are preserved exactly. Minification only touches whitespace. The parse tree before and after is identical.

Does minification remove JSON comments?

JSON doesn't support comments. If your file has comments (like a JSONC or JSON5 file) it's not standard JSON, and a standard JSON minifier will reject it as invalid. Tools that handle JSON with comments need to strip them explicitly before parsing.

Should I minify JSON in my API responses manually?

Usually not manually, most HTTP frameworks serialize JSON compactly by default. In Node.js, `JSON.stringify(data)` with no third argument produces minified output; `JSON.stringify(data, null, 2)` produces formatted output. Most API frameworks default to the compact form when serializing responses.

Can minifying change my data, such as a long ID or a price like 19.90?

No. Minifying here only deletes the spaces and line breaks between tokens. Every value is copied character for character, so an order ID of 9007199254740993 is not rounded to 9007199254740992 the way a JSON.parse and JSON.stringify round trip would round it, and a price written 19.90 keeps its trailing zero. That matters when the minified payload goes to an API or a signature check that compares bytes. If one object repeats a key, both copies stay in the output and the status line warns you, since the service receiving it will probably keep only the last one.

What Is JSON Minification?All Developer Utilities