Ready, runs in your browser
0 chars · 0 words
bytes leaving your device
0
steps to compact JSON
2
no signup, no run limit
Free

JSON minifier

What the JSON minifier does

Paste any valid JSON, however it's currently formatted, spread across lines, inconsistently indented, already partly compact, and this app parses it and returns the smallest valid representation of the exact same data: no line breaks, no indentation, no unnecessary spaces.

It's local. Parsing and minifying run in your browser, not on a server, so nothing you paste is uploaded and there's no limit on how much JSON you minify.

The underlying fact

Why whitespace in JSON doesn't matter, in plain terms

JSON's grammar treats spaces, tabs and line breaks between its structural characters, braces, brackets, colons, commas, as entirely optional. '{"a":1}' and the same object spread across five indented lines describe exactly the same data to anything parsing it. The formatting exists purely for whoever's reading the file, never for the machine consuming it.

That's exactly what minifying takes advantage of: since none of that whitespace changes the meaning, removing every byte of it produces a file functionally identical to the original but smaller.

Workflow

How to minify JSON in three steps

Nothing to configure, nothing to install.

Step 1
Paste your JSON into the input field, whatever format it's currently in.
Step 2
Press Minify. The app parses and re-serialises it instantly, on your own device.
Step 3
Copy the compact result from the output panel.

Why it matters

What minifying JSON actually saves you

The saving is pure byte count, nothing about the data's structure or meaning changes. For a payload embedded in a URL query parameter, a value stuffed into an environment variable, a script tag's inline data, or a '.min.json' asset shipped to every visitor, every removed byte is one less byte to transmit and parse.

For a small, one-off object the difference is trivial. For a large config file, a sizeable API response used as a fixture, or an asset served to thousands of page loads, the removed whitespace adds up to a real, if modest, reduction in transfer size.

A side effect worth knowing

Why minifying also validates your JSON, and why that matters

To minify anything, this app first has to parse it, which means anything that isn't syntactically valid JSON, a trailing comma, an unquoted key, a comment, gets rejected outright rather than silently mangled. That makes this app a quick validity check as a side effect, even when saving bytes wasn't the point of pasting something in.

A common reason for rejection is pasting JSON5 or JSONC, formats that allow comments and trailing commas and look almost identical to plain JSON. Standard JSON supports neither, so text copied from a config written in one of those relaxed formats fails here until the comments and trailing commas are removed.

Straight answer

Does valid JSON mean correct data?

No, worth being direct about that. This app confirms what you pasted follows JSON's syntax rules, correctly matched braces and brackets, properly quoted keys, no trailing commas. It has no idea whether the values inside are the right values, whether a required field's missing, or whether a number should've been a string.

Syntactic validity and correctness are two different things. Minifying, or its counterpart, pretty-printing, only ever addresses the first.

Who it's for

Who uses a JSON minifier, and when

Developers use it to shrink a config value that has to fit into a single environment variable, a URL parameter or a command-line argument. Front-end engineers use it to compact a small JSON asset before it ships to every page load, when a build tool's own minification step isn't available.

Anyone preparing a JSON payload for a single-line log entry, a database column that doesn't handle line breaks well, or a chat message with a length limit uses it to compress the JSON to one clean line without touching any of the data inside.

FAQ

Everything answered. Nothing to click open.

How do I minify JSON?

Paste your JSON above and press Minify. The compact, single-line version appears in the output box, ready to copy.

Is it free?

Yes, no signup, no paste limit, no run limit. It runs entirely in your browser.

Is my data uploaded anywhere?

No, parsing and minifying happen on your own device. Nothing is transmitted or stored.

Does minifying change any of my data?

No, only whitespace between structural characters is removed. Every key, value and array item stays exactly as it was.

Why does it say my JSON is invalid?

The text doesn't follow JSON's syntax rules, most often a trailing comma, an unquoted key, or a comment, none of which standard JSON allows.

Does it work on JSON5 or JSONC with comments?

No, standard JSON doesn't support comments or trailing commas, so text in those relaxed formats needs those removed first.

Does it sort or reorder my object keys?

No, keys stay in the exact order they appeared. Minifying only removes whitespace, it doesn't reorganise anything.

Does it work on large JSON files?

Yes, no length cap and no run limit. Very large files depend on your own device's memory.

Does it work on phones?

Yes, the layout stacks on narrow screens.

What's the difference between this and the JSON prettifier?

This removes all unnecessary whitespace to make the file as small as possible. The prettifier does the opposite, adding indentation and line breaks for readability.

Does minifying confirm my data is correct, not just valid syntax?

No, it only confirms the syntax parses. It can't tell if a value is wrong, a field's missing, or a number should've been a string.

Will minifying break my JSON in any way?

No, the result describes exactly the same data as the input. Minifying is lossless as far as the data itself is concerned.

Can I minify an array instead of an object?

Yes, any valid JSON value, an object, an array, a string, a number, minifies the same way.

Is there a batch mode or an API?

Not yet, paste, minify, copy for now.

Does it remove comments from my JSON?

It can't, since standard JSON doesn't support comments at all, so a file containing them fails to parse rather than having them stripped.

Why would I minify instead of deleting line breaks myself?

A manual find-and-replace can break string values that legitimately contain a line break or extra spaces. This app parses the structure first, so it never touches a string value incorrectly.

Does it handle Unicode characters and emoji correctly?

Yes, any valid JSON string content passes through unchanged, since minifying only affects whitespace between structural characters.

Is my data safe to paste if it's confidential?

Yes, nothing is transmitted anywhere. Processing happens locally in your browser.

How much smaller does minifying actually make my file?

It depends entirely on how much whitespace the original had. A heavily indented, deeply nested file shrinks more than one that was already fairly compact.

Can I use the minified output directly in my code?

Yes, minified JSON is exactly as valid as pretty-printed JSON to any parser. The formatting change has no effect on how it's consumed.