Mita SchoolStudent Innovation Lab

DEVELOPER TOOLS MITA-001

JSON Minifier Online

Remove unnecessary whitespace from JSON while keeping strings, number tokens, and object members intact. Compact payloads, with validation built in.

JSON stays in your browser Free · No sign-up Original tokens preserved
Output
Your formatted JSON will appear here.
Try an example to get started.
Ready when you are Browser only
Root type
—
Values
—
Deepest value level
—
Output size
—

Supports dot names, array indexes, and double-quoted bracket keys. Tree paths refer to the full input; no wildcards.

Paste or drop a local file · Ctrl / ⌘ + Enter to minify · Ctrl / ⌘ + Shift + M to minifyUp to 10 MiB · 256 nesting levels · 300,000 values

How to minify JSON without changing its values

JSON minification removes spaces, tabs, and line breaks that exist between tokens. It keeps whitespace inside quoted strings because that whitespace belongs to the data. A person’s name such as "Ada Lovelace" must retain its internal space.

  1. Paste a document or open a local file.
  2. Choose Minify JSON. Invalid syntax stops the operation and reports an error.
  3. Review warnings and the compact result. Copy the output or download minified.json.

The status and output size help you check the result. The minification message reports bytes of whitespace removed from the input. If the input was already compact, zero bytes removed is a normal result.

Before and after JSON minification

Readable version:

{
  "name": "Ada Lovelace",
  "active": true,
  "score": 98.50
}

Compact version:

{"name":"Ada Lovelace","active":true,"score":98.50}

The whitespace surrounding the fields disappears. The name’s internal space and the original number token 98.50 remain. Sorting is a separate option: leave Sort keys unchecked when you want to preserve member order.

Minification and compression solve different problems

A JSON minifier creates valid JSON text with fewer layout characters. Gzip or Brotli compress the bytes sent over a connection. Minified JSON stays directly readable by a JSON parser; compressed bytes must first be decompressed.

The benefit depends on the document. Indented files contain more removable whitespace than one-line payloads. A minifier does not reduce a long string, shrink an array’s items, remove unused properties, or replace repeated values. Removing those requires a deliberate data-model change.

When measuring a live API, look at the response’s actual transferred size and server compression settings. The tool reports UTF-8 text bytes, not a network benchmark or a simulated gzip result.

Why removing whitespace with a regular expression is risky

A blanket replacement such as text.replace(/\s/g, "") removes spaces and line breaks inside strings too. That can turn "New York" into a different value. This tool reads the JSON structure and writes the original tokens with layout whitespace removed.

That approach also keeps long integer IDs, escaped strings, duplicate object members, and exponential number notation visible. Any duplicate-key or number-range warning still matters to the application that will consume the result.

When compact JSON is useful

  • Preparing a compact document to paste into a request body.
  • Reducing the size of a JSON text file that includes extensive indentation.
  • Inspecting whether an export contains removable layout whitespace.
  • Keeping a machine-facing artifact compact while maintaining a readable source version.

For review and debugging, switch back to JSON Formatter & Validator. For structure inspection, use the JSON tree viewer. Each view serves a different stage of the same workflow.

Frequently asked questions

Does JSON minification remove spaces inside strings?

No. Spaces and escape sequences inside string tokens remain intact. Only whitespace between tokens is removed.

Does minification fix invalid JSON?

No. The tool validates first and stops on invalid syntax. Use Repair preview for the supported edits, or correct the reported error manually.

Will minifying JSON improve every API response?

The reduction depends on how much layout whitespace exists. Already compact JSON may not shrink. Network compression and the amount of data returned are separate considerations.

Can I restore the original layout?

Formatting creates a new readable layout but cannot recover the exact indentation or line-break style that was removed. Keep the source if that exact layout matters.

Understand the document you are working with.

Built for Mita Innovation Lab · MITA-001 · Web DevelopmentRelease 1.0 · October 2026