JSON Beautifier
Beautify JSON with 2-space, 4-space, or tab indentation.
Minify JSON online by stripping whitespace and line breaks to reduce file size. Paste your JSON and get a compact single-line version instantly, with the exact size savings displayed. The minifier validates your JSON as it works, all 100% client-side in your browser.
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.
{
"id": 4821,
"name": "Nadia Okonjo",
"active": true,
"roles": [
"admin",
"billing"
],
"meta": {
"created": "2024-03-11T09:24:00Z",
"score": 91.5
}
}{"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.
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.
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:
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.
Every byte matters when JSON travels over the network or sits in storage at scale. Pretty-printed JSON is great for humans but wasteful for machines: indentation and line breaks can account for a third of the file. This JSON minify online tool compresses JSON to its smallest valid form in one click, reports the exact bytes saved, and refuses to output anything if the input has a syntax error, so you never ship a broken payload. Use it to shrink API fixtures, tighten config files before deployment, compress JSON stored in databases or caches, and trim request bodies for bandwidth-sensitive clients. Since processing is entirely client-side, even sensitive production payloads are safe to minify here.