Find your next tool

Browse tools or search by task

Explore JSONToonPro

JSON Tools

JSON Minifier Online – Compress JSON Instantly

Minify JSON online by removing whitespace and line breaks. See exact bytes saved, validate syntax and copy compact JSON without uploading your data.

Runs locally in your browser. Nothing you paste is uploaded.

JSON Minifier workspace
Input JSON
Output
Paste JSON to format, beautify, validate, minify, analyze, or view it as a tree.
0 input chars0 output charsWaiting for valid JSON

How JSON Minification Works

Paste valid JSON and choose Minify to serialize it without indentation. The output stays JSON, so it can still be parsed normally. Compare the input and output sizes, then copy the compact result for transport or storage.

What JSON Minification Removes

Whitespace between tokens disappears. Spaces inside quoted strings are meaningful data and remain. Parsing and serialization can normalize number spellings and escape sequences; this is not a byte-for-byte transformation of the original source.

Minified JSON vs Gzip and Brotli

Minification changes the JSON text itself. Gzip and Brotli compress bytes at the transport layer and can be used after minification. A smaller character count is not a prediction of compressed network savings.

When to Minify JSON

Compact JSON works well for generated assets, API payloads and machine-readable storage. Keep source configuration readable if people review it. Minification is neither encryption nor removal of private fields.

JSON Minification Examples

For example, { "city": "New York", "count": 2 } becomes {"city":"New York","count":2}. The space in New York is retained. Already compact JSON will usually have little whitespace left to remove.

More examples and technical details

What Minifying Removes

Minifying JSON removes insignificant whitespace and nothing else. Insignificant means whitespace that sits between tokens rather than inside them: the line breaks after commas and braces, the indentation at the start of each line, and the space after a colon. Every one of those exists purely for human readers, and the parser discards them before it ever builds a value.

Nothing else is touched. Keys are not shortened, values are not rewritten, order is not changed, and whitespace inside a string is preserved exactly, because that whitespace is data. This is the crucial difference between JSON minification and JavaScript minification: a JS minifier renames variables and rewrites expressions, whereas a JSON minifier can only delete padding. The minified output parses to a structure identical to the original in every respect.

BEFORE, 179 BYTES
{
  "id": 4821,
  "name": "Nadia Okonjo",
  "active": true,
  "roles": [
    "admin",
    "billing"
  ],
  "meta": {
    "created": "2024-03-11T09:24:00Z",
    "score": 91.5
  }
}
AFTER, 130 BYTES
{"id":4821,"name":"Nadia Okonjo","active":true,"roles":["admin","billing"],"meta":{"created":"2024-03-11T09:24:00Z","score":91.5}}

That is 49 bytes removed from 179, a reduction of about 27 percent, and the two documents are indistinguishable to any consumer.

How Much Smaller Will It Get

Typical reductions land between 15 and 40 percent. Where a given file falls depends almost entirely on two things: how wide the original indentation was, and how deeply the data nests.

The reason is arithmetic. Every line contributes one line break plus the indent for its depth. A file indented with four spaces at an average depth of five carries 21 wasted bytes per line before the content starts. If the average line holds 30 bytes of actual data, more than 40 percent of the file is padding. The same data with two-space indentation at an average depth of two carries five wasted bytes per line, and minifying will barely reach 15 percent.

This produces a rule of thumb that is genuinely useful: deeply nested documents with many short values save the most, and flat documents with long string values save the least. A configuration tree full of booleans and small numbers is mostly structure, so it shrinks hard. An export where each record holds a paragraph of text is mostly payload, and the whitespace was never a meaningful share of it to begin with.

Minification and Compression Are Different Things

This is the point that changes how you should think about minifying, and it is the one most often missed. Gzip and Brotli are extremely good at exactly the kind of redundancy that indentation creates. A run of repeated spaces and a line break that appears thousands of times is the easiest possible input for a dictionary-based compressor, and it collapses to almost nothing.

So when a response is served with Content-Encoding gzip or br, which is the default for essentially every web server and CDN today, the compressed size of the pretty version and the compressed size of the minified version are often within a few percent of each other. The 27 percent saving in the earlier example largely evaporates once both files pass through the same compressor. Minifying before compression is not useless, but the marginal gain is far smaller than the raw byte counts suggest, and it is not where your transfer budget is going.

Minification earns its keep specifically where compression is not applied. Those cases are worth knowing:

  • Stored uncompressed. JSON sitting in a database column, a cache entry, or a message queue payload is usually held verbatim, so every whitespace byte is paid for on every read and every replica.
  • Embedded in a URL. Query strings and fragments are not compressed, and percent-encoding inflates every space and newline to three characters before it counts against the length limit.
  • Inside an HTML attribute. A data attribute holding JSON is compressed only as part of the surrounding page, and the indentation adds noise to something no one will read as text anyway.
  • Against a hard size limit. Message brokers, webhook bodies, serverless payload caps, cookie sizes, and log line limits are measured on the raw bytes you send, so shaving a quarter off can be the difference between accepted and rejected.

When Not to Minify

Minifying has a real cost, and it is paid by people rather than machines. There are places where the readable form is simply worth more than the bytes.

Never minify a file under version control. A single-line document turns every change into a full-file rewrite in the diff, code review becomes impossible, and merge conflicts on that line have to be resolved by hand character by character. Committed configuration such as package.json, tsconfig.json, and any manifest should always stay formatted for exactly this reason.

Never minify anything a human is expected to read or edit: fixtures, seed data, documentation examples, saved API samples, and files a support engineer may open at three in the morning. The few kilobytes you save are worth far less than the time lost re-formatting the file before anyone can work with it.

The sensible workflow keeps both forms without treating either as the source of truth for the other. Author and store formatted, minify as a build or serialization step on the way out, and never let the minified artifact be the version you edit.

The JSON Formatter reverses this whenever you need the readable version back, and the JSON Validator confirms the result still parses. Browse the full collection of free JSON tools to find the right one for the job.

Standards and references

Frequently asked questions

What does JSON minification remove?

It removes indentation, line breaks and other insignificant whitespace between JSON tokens.

Does minifying JSON change values?

String contents and parsed values are preserved, subject to JavaScript number precision and serialization normalization. Back up precision-sensitive source data.

How much smaller can JSON become?

Savings depend on indentation and nesting. Already minified input may save nothing; compare the tool’s actual size metrics.

Should JSON in Git be minified?

Usually keep hand-edited JSON readable in Git. Generate the minified version as a build or export step.