JSON Minifier
Compress JSON into a single line.
JSON Minifier – Compress JSON to One Line
The JSON minifier strips every unnecessary space, tab, and line break from your JSON and returns it as one compact line. Paste formatted JSON, and you instantly get the minified version together with the byte size before and after, so you can see how much you saved.
When to minify JSON
- API payloads and fixtures – smaller request and response bodies load faster and are cheaper to store.
- Environment variables and CLI arguments – many tools accept JSON only on a single line.
- JSON Lines / NDJSON – each record must fit on one line. For whole arrays, the JSON to JSON Lines converter does this for every item.
- Embedding JSON in HTML data attributes, SQL statements, or configuration strings.
Safe by design
Minifying works by parsing the JSON and serializing it again without whitespace, so the output is guaranteed to be valid JSON with identical data. Characters inside strings are never touched, numbers keep their value, and key order stays the same. If the input has a syntax error, the tool shows its line and column instead of producing broken output.
How to use it
Paste your JSON or open a .json file. The one-line result appears on the right; press Copy or Download. The chips below show the original size, the minified size, and the percentage saved, all measured in UTF-8 bytes.
Going the other way
To turn a minified line back into readable JSON, use the JSON Beautifier. If you need the minified JSON as an escaped string literal for code, try JSON Stringify.
Frequently Asked Questions
What does a JSON minifier remove?
Only insignificant whitespace: spaces, tabs, and line breaks between tokens. Whitespace inside string values is part of the data and is kept, so the minified JSON parses to exactly the same object as the original.
Is 'JSON to one line' the same as minifying?
Yes. Minified JSON is always a single line, which is what you need for environment variables, single-line log entries, JSON Lines files, or pasting a payload into a curl command.
How much smaller will my file get?
It depends on how it was formatted. Pretty-printed JSON with 4-space indentation typically shrinks by 15–40%. The tool shows the exact byte size before and after, measured as UTF-8.
Does minification replace gzip?
No, they work well together. Servers usually compress JSON with gzip or Brotli, which already removes much of the whitespace overhead, but minifying first still saves bytes and memory, especially for JSON stored in databases, caches, or local storage.