JSON Minifier

Strip all insignificant whitespace from JSON and see exactly how many bytes you saved -- keeps big numbers and key order exactly as typed, entirely in your browser. Fast, free, and built for simple browser-based workflows.

Instant
Processing
Private
Browser First
Free
No Signup

JSON Minifier

or Ctrl+Enter

Minifying happens entirely in this browser tab. The JSON you paste, drop or open here — an API response, a config file, an export with customer data — is never sent anywhere.

Paste some JSON above, drop a .json file, or try the example.


    

Go to error

Advertisement

728 x 90 In-Content Ad

About This Tool

JSON Minifier is a free online tool that strips every unnecessary space, tab, and line break from JSON to shrink it to the smallest valid size. Paste JSON, open a .json file, or drop one onto the page, and it prints a single compact line and tells you exactly how many bytes you saved.

It earns its keep whenever JSON needs to travel somewhere size matters: a config value you're about to embed in an environment variable, a sample payload going into documentation or a test fixture, or an API response you want to paste into a chat thread without a wall of indentation taking over the screen. Stripping whitespace by hand risks breaking a string by accident, since a stray edit inside a quoted value corrupts the data -- the same mistake a naive whitespace stripper can make without you noticing.

Minifying happens entirely in this browser tab, so the JSON you paste, drop or open here -- an API response, a config file, an export with customer data -- is never sent anywhere. That matters when you're shrinking a payload that still has live keys or personal fields in it, and it means there's no upload step to wait through first.

Reports bytes saved before and after using real UTF-8 byte counts, not character counts
Parses JSON properly instead of stripping whitespace with a regex, so a space or tab inside a string is never touched
Keeps big integers, key order and duplicate keys exactly as typed -- nothing is rounded, reordered or dropped
Accepts JSONC (comments and trailing commas) for files like tsconfig.json or VS Code settings
Shows the exact line, column and a snippet for every syntax error, not just "invalid JSON"
Minifies entirely in this browser tab -- the JSON you paste, drop or open is never sent anywhere

How to Use JSON Minifier

1

Paste or open your JSON

Paste JSON into the box, click Open file to choose a .json file, or drag one onto the box. Click "Try an example" to see a sample with a large id.

2

Turn on JSONC if needed

Tick "Accept comments and trailing commas (JSONC)" if your file has // or /* */ comments or a trailing comma, like tsconfig.json. Leave it off for standard JSON.

3

Click Minify JSON

Press Minify JSON, or Ctrl+Enter from anywhere on the page. Valid JSON collapses to a single compact line with the bytes saved shown above it; invalid JSON shows the exact line, column and a Go to error link.

4

Copy or download the result

Use Copy for the clipboard or Download to save it as minified.json. Clear resets the input, output and any error state.

Frequently Asked Questions

Is this tool completely free?

Yes! All our tools are 100% free to use with no hidden costs, no registration required, and no credit card needed.

Is my data safe and private?

Absolutely. All tools run entirely in your browser (client-side). Your data never leaves your device and is not sent to our servers.

Can I use this tool offline?

Yes, once the page is loaded, the tool will continue to work even if you lose internet connection since it runs in your browser.

Is there a character limit?

There is no strict character limit, but very large amounts of text (100,000+ characters) may slow down your browser.

Can I use this for commercial projects?

Yes! All our tools are free for both personal and commercial use.

How is this different from JSON Formatter?

JSON Formatter adds indentation to make JSON easy to read; this tool does the opposite -- it strips every insignificant space to make the file as small as possible and reports exactly how many bytes that saved. Use Formatter when you want readable output, and this page when you want the smallest valid file to ship or store.

Does this tool validate my JSON first?

It scans your JSON the same way a validator does, so invalid JSON is rejected with the exact line and column instead of silently producing broken output -- but it does not warn about valid-but-risky JSON like duplicate keys, oversized numbers or deep nesting, or report document stats. Use JSON Validator when you need that full report.

Why not just strip whitespace with find-and-replace?

Because that can corrupt your data. A plain find-and-replace or regex has no idea whether a space sits inside a string or between tokens, so it can delete a space you typed on purpose inside a value like "two words", or mangle an escape sequence. This tool parses the JSON properly first, so only whitespace between tokens is ever removed.

Does minifying change my numbers?

No. Numbers are copied exactly as typed, including very large integers, trailing zeros like 1.0, and scientific notation like 1e400. Most tools parse JSON into JavaScript numbers first, which silently rounds any integer above about 9 quadrillion -- this one never does that.

What happens to duplicate keys in my JSON?

Both are kept, in the order they appeared. JSON technically allows duplicate keys even though most parsers only keep the last one, and minifying never silently drops data because of it -- the result message tells you how many duplicates it found.

Can I minify JSON that has comments in it?

Only if you turn on the JSONC option. Standard JSON does not allow // or /* */ comments or trailing commas, so by default they are treated as errors. Turning on JSONC accepts both and removes them from the output along with the rest of the whitespace, which is useful for files like tsconfig.json.

How is "bytes saved" calculated?

By measuring the actual UTF-8 byte size of your input and the minified output with TextEncoder, then subtracting -- never by counting characters. That matters outside plain ASCII: an emoji is 4 bytes and an accented letter is usually 2, even though each counts as only one or two JavaScript characters.

Why does it say "Already minimal: 0 bytes saved"?

Because your JSON already had no extra whitespace, comments or trailing commas to remove, so the minified output is identical to what you pasted. That is the expected result for JSON that was already minified somewhere else, not an error.

Does it work on a huge file?

Yes. Most files up to a few megabytes minify instantly. Above about 10MB you will see a brief "this may take a few seconds" notice before it runs, and the result is limited only by your own device's memory, not a server timeout.

Does it work with NDJSON (one JSON value per line)?

Not as a single input -- this tool expects one JSON document, so pasting several values back to back produces an error naming NDJSON as the likely cause. Minify each line separately instead.