JSON Minifier

Minify and compress JSON by removing whitespace

Keys stay in the order they were written.

JSON Input

Waiting for JSON. The one-line copy shows up on the right.

Minified Output

Paste your JSON on the left and the result shows up here.

Or drop a file on this box, , or .

What is JSON Minifier?

Need to shrink your JSON file size? This tool removes all the extra whitespace, line breaks, and indentation from your JSON (JavaScript Object Notation). Your JSON stays completely valid, just way smaller.

Smaller payloads mean less to send and store, though if your server already gzips responses the gain is smaller than the raw numbers suggest. The minifier checks your JSON against the RFC 8259 JSON specification and then drops the whitespace between tokens. Values are copied across as text, which is where it parts ways with the usual JSON.stringify(JSON.parse(text)) trick described on MDN. Give that trick {"rsrp": -98.50, "iccid": 8901240544102066246} and it hands back -98.5 and 8901240544102066000; this page keeps -98.50 and all nineteen digits.

The minifier has no upload or share step; the parse and re-print happen in this tab. The size figures at the right of the toolbar count UTF-8 bytes rather than characters, so an emoji or an accented name counts the way it will on the wire, and the Saved figure is what you can quote in a pull request.

How to Use the JSON Minifier

No Minify button to press: the compact version and the byte counts above it follow every edit you make. Paste, read the Saved figure, take the output.

1

Paste, Upload, or Load Sample

Put the pretty-printed document on the left, for example a fixture file or a config you have been editing by hand. Type it, press Paste to pull it off the clipboard (the browser asks for permission the first time), or Upload a .json / .txt file. Sample loads an indented subscriber profile so you can see a realistic saving straight away. Input like this:

{
  "subscriberId": "SUB-1001",
  "plan": "Unlimited 5G",
  "dataUsage": 45.2,
  "status": "active"
}

A document that will not parse turns the strip under the input red. Take the comma off the end of "plan": "Unlimited 5G" in the sample and the strip points at Line 5, column 5, where "dataUsage" begins and the parser first notices the missing comma. That line is shaded as well, and a click on the strip puts your cursor on it. For files with many mistakes, the JSON Fixer is the quicker route.

2

Read the Stats, Sort if You Need To

The right Minified Output panel holds the one-line JSON, and the toolbar above shows Original, Minified and Saved. The sample goes from 381 to 252 bytes, which the toolbar shows as Saved: 129 Bytes (33.9%). With Sort keys A to Z pressed, the keys of each object, nested ones included, are put in alphabetical order before minifying, so the sample starts {"subscriber":{"account":{"billingCycle":"monthly". The byte count stays the same, since only the order moved. On a phone the toolbar keeps just the Saved figure.

3

Copy or Download

Copy is the one you want for an environment variable or a cURL -d argument, where a single line is the point. Download writes minified.json. Clear resets the input and the size figures together.

When You'd Actually Use This

Production Deployment

Squeezing a JSON value into a place that hates newlines: a Kubernetes ConfigMap literal, a GitHub Actions secret, a single-line log field, or a query parameter with a length limit.

Mobile Optimization

Every byte counts on mobile networks. Minified JSON reduces data usage, improving load times and user experience on slower connections.

API Requests

Send minified JSON in API requests to reduce payload size. Works great with REST APIs or GraphQL queries.

Config Files

Minify JSON configuration files for production. Keeps settings valid while reducing file size, especially useful for large configs.

Common Questions

Is my JSON data stored?

Nope. The minifying is done by this page's own script in your browser, and it follows the same syntax rules as JSON.parse(). Your data never leaves your computer, and Paste reads the clipboard only when you press it.

How much space can I save?

It depends on how much whitespace your JSON has. Pretty-printed JSON with deep indentation often shrinks by a third or more; JSON that's already compact barely changes. The stats show exactly how much you saved on your input.

Does minification break JSON?

No. Minified JSON is still valid JSON with the same data, and with sorting off only the whitespace between tokens is removed. Nothing inside a value is rewritten: {"name":"Ren\u00e9e","limit":1.0,"cap":1E5} comes out with the escape, the 1.0 and the 1E5 as they were. The one change you can see is a key written twice in the same object: the last value is kept, as any JSON parser would do when reading the file.

Can I format minified JSON back?

Yes. Use the JSON Formatter to turn minified JSON back into readable, indented JSON. The data is the same either way. If you'd rather read it as rows and columns, the online JSON parser accepts minified JSON as it is.

What's the difference from compression?

Minification removes whitespace only. Compression (like gzip or Brotli) runs an algorithm over the bytes to shrink them further. Minified JSON can still be compressed for even smaller files, and most web servers do that for you.

Can I minify invalid JSON?

Nah, you'll need valid JSON first. The input is checked before anything is minified, and a broken document gets the line and column of its first problem in the red strip under the editor. Click it, fix that spot, and the output comes back on its own.

When is sorting the keys worth it?

When two copies of the same data should produce the same bytes. A cache key, a checksum or a snapshot test compares text, and two services rarely write keys in the same order. With Sort keys A to Z on, {"cell":{"mcc":"310","rsrp":-98.50,"band":"B66"}} always becomes {"cell":{"band":"B66","mcc":"310","rsrp":-98.50}}. Arrays keep their order, because the position of an item usually carries meaning.

Other JSON Tools You Might Need

If the minifier reports invalid JSON, start with the validator or the fixer. To get an indented copy again, or to move the same records into CSV, YAML or XML, use these: