JSON Minifier

Free Online JSON Minifier

Compress JSON by stripping whitespace and line breaks to shrink payload size, in your browser, with no upload.

No sign-up to start · Runs in your browser

JSON Minifier
Open in full editor
Input
Output

Runs entirely in your browser — nothing is uploaded.

{
  "service": "checkout",
  "version": "2.4.1",
  "enabled": true,
  "retries": 3,
  "endpoints": {
    "primary": "https://api.example.com/v2",
    "fallback": "https://api-eu.example.com/v2"
  },
  "features": ["idempotency", "webhooks", "3ds"],
  "timeoutMs": 8000
}
A JSON minifier removes the whitespace, indentation, and line breaks between tokens so the same data travels in fewer bytes. JSON Copilot minifies by parsing your JSON and re-serializing it as compact, single-line output, so the result parses back to exactly the same value. It runs in your browser in one click, so nothing is uploaded, and it is free with no account. When you need to read the result again, the built-in formatter re-expands it instantly.

Minify JSON: before and after

Formatted input (98 bytes)
{
  "id": "usr_8842",
  "name": "Ada Lovelace",
  "roles": ["admin", "editor"],
  "active": true
}
Minified output (80 bytes)
{"id":"usr_8842","name":"Ada Lovelace","roles":["admin","editor"],"active":true}

The formatted input is 98 bytes and the minified output is 80 — an 18% reduction, and the two strings parse to exactly the same object. The space inside "Ada Lovelace" survives because it sits inside a string value, not between tokens. Larger, deeply indented documents save far more, and the gain compounds once your server also gzips the response.

How to minify JSON

  1. 1

    Paste your JSON

    Add formatted, indented, or messy JSON to the editor. It is validated as you type, so you catch syntax errors before minifying.

  2. 2

    Click Minify

    JSON Copilot removes the whitespace between tokens and returns compact, single-line JSON — the smallest form that still parses to your data.

  3. 3

    Check the size saving

    The status line reports how many bytes and what percentage you saved, comparing the input and output character counts.

  4. 4

    Copy or download

    Grab the minified output for your API response, config payload, or clipboard, ready to ship over the network.

  5. 5

    Re-expand anytime

    Run Format to restore indentation and line breaks whenever you need to read, review, or debug the data again.

Why minify with JSON Copilot

Smaller payloads

Removes whitespace to cut bytes from API responses, config files, and anything sent over the network.

Value-lossless output

Your JSON is parsed and re-serialized compactly, so the minified output parses back to exactly the same value.

Private & client-side

Minification runs entirely in your browser, so your JSON is never uploaded anywhere.

Reversible in one click

Re-expand minified JSON with the built-in formatter whenever you need it readable again.

Validated as you go

Invalid JSON is flagged with line-level errors before you minify, so you never ship broken output.

Handles large files

The Monaco-based editor stays responsive on big documents, and everything keeps working offline after load.

What minifying removes, and what it preserves

Under RFC 8259, the JSON grammar treats four characters — space, horizontal tab, line feed, and carriage return — as insignificant whitespace when they sit between tokens. JSON Copilot minifies by parsing the document and re-serializing it with no whitespace between tokens: no indentation, no space after colons or commas, and no newlines separating properties. The result is compact, single-line JSON that parses to the same value your input did.

Whitespace inside a string is significant and is preserved. If a value contains a name like Ada Lovelace, the space between the words stays, because it is part of the data rather than the formatting. Escape sequences, Unicode characters, and newlines written as \n inside a string keep their meaning as well — the string values you get back are exactly the ones you put in.

Because the output is re-serialized rather than a raw character-for-character whitespace strip, a few things are made canonical. Numbers lose redundant formatting — 1.0 becomes 1, 1e3 becomes 1000, and trailing zeros disappear — duplicate keys collapse to their last value, and integer-like keys are emitted in ascending numeric order. None of this changes what the JSON means, since the spec assigns no significance to number spelling, key order, or repeated keys. It is still far safer than minifying JavaScript or CSS, where a tool may rename identifiers or drop rules that change behavior.

Minify vs gzip: complementary, not competing

Minifying and gzip solve overlapping but distinct problems. Minifying works on the source text, removing whitespace before the payload is ever stored or sent. Gzip and Brotli are transport-level compressors that a web server applies on the fly, negotiated through the Accept-Encoding and Content-Encoding headers. One shrinks the characters; the other compresses the bytes.

Because gzip already models repeated runs of spaces and newlines efficiently, minifying on top of compression yields a smaller extra win than the raw byte numbers suggest — often only a few percent on the wire. The saving is still real, and it shows up in places compression does not reach: the size held in memory, the bytes written to a database column or localStorage, and the cost of parsing, since the parser has fewer characters to scan.

The practical rule is to do both. Minify JSON that you ship, and make sure gzip or Brotli is enabled on your API responses and static assets. For payloads that never touch a compressing transport — a message-queue body, a signed token, an embedded data attribute — minifying is often the only size lever you have, so it matters most there.

When to minify — and when to keep it readable

Minify anything that travels or is stored at scale: API responses, WebSocket frames, message-broker payloads, JSON embedded in HTML data attributes, and values you push into localStorage or a size-limited cache. In those cases every byte is multiplied by traffic or quota, and no human reads the raw text, so the whitespace is pure overhead.

Keep JSON formatted when a person reads or edits it. Configuration files such as package.json, tsconfig.json, or a CI workflow belong in version control, where indentation and line breaks produce clean, line-by-line diffs during code review. Minifying them collapses everything onto one line, so a one-character change looks like the whole file was rewritten. Logs you grep and fixtures you eyeball are the same story: readability beats a handful of saved bytes.

The common pattern is to separate source from output. You author and commit formatted JSON, then let a build step or your API layer minify at the moment of shipping. That keeps your repository reviewable while the wire stays lean — and because minifying preserves the value, the formatted and minified copies carry the same data.

Is JSON minification lossless?

At the value level, yes. Parse the pretty version and the minified version and you get deeply equal values. Formally, JSON.parse on the minified string produces the same object as JSON.parse on the formatted string, which is why you can move between the two forms freely. JSON Copilot re-expands any minified document with a single Format click.

Two nuances are worth knowing. First, because the minifier re-serializes through the JSON number type, values are made canonical: 1.0 becomes 1, 1e3 becomes 1000, and duplicate keys collapse to their last value. The parsed data is unchanged, but the text is canonical rather than a copy of your original spelling. Second, JSON numbers are IEEE 754 doubles here, so an integer with more than about 15 to 17 significant digits — a 64-bit ID sent as a bare number, say — can lose precision on the round trip. If you carry such values, keep them as strings so no re-serialization step can round them.

It validates first, too. Genuinely broken input, or JSON5 extras like comments and trailing commas that are not valid JSON, are flagged with a line-level error before anything is minified — so you never ship output that fails to parse. Fix the reported line, minify again, and the result round-trips to the same value.

Frequently asked questions

Is the JSON minifier free?

Yes. Minifying, formatting, and validation are free, need no account, and run entirely in your browser. AI features use credits, with 1,000 free on signup.

Where does my JSON go when I minify it?

Nowhere — minification is 100% client-side, so the text is rewritten in your browser and never sent to a server. That makes it safe for production payloads and configs that contain secrets. Only the optional AI features transmit data, and those mask detected sensitive values on your device first.

Does minifying change my data?

The data is preserved — the minified output parses to the same value. Re-serializing also normalizes number formatting (1.0 becomes 1) and collapses any duplicate keys to their last value, but that does not change what the JSON means.

How much smaller will my JSON get?

It depends on how much indentation the original had. Files pretty-printed with 2- or 4-space indentation often shrink 20-50%; already-compact JSON barely changes.

What is the difference between minifying and gzip?

Minifying removes whitespace from the text; gzip and Brotli compress the bytes on the wire. They are complementary — minify first, then let your server compress the response for the biggest saving.

Can it handle large files, and does it work offline?

Yes. The editor is built for large documents, and because everything runs locally it keeps working with no network connection once the page has loaded.

How do I convert JSON to one line?

That is exactly what minifying does: paste your JSON, click Minify, and every line break and indent is removed, leaving the whole document on a single line. A JSON one-liner and minified JSON are the same thing — useful for env vars, curl bodies, and anywhere a value has to fit on one row.

How do I un-minify (expand) JSON again?

Click Format. JSON Copilot re-adds indentation and line breaks, turning the single line back into readable, reviewable output.

Are there any limits?

Minification itself has no row or size cap beyond your browser memory. The 100-node preview limit and credit-based pricing apply only to the mind map and AI features.

Related tools

Minify your JSON now

Open the Editor