JSON to One Line
Paste formatted JSON and compress it into a single minified line. Removes all whitespace, indentation, and line breaks while keeping the data intact.
Last updated: May 28, 2026
Find this tool useful? Support the project to keep it free!
Buy me a coffeeWhat is JSON to One Line?
"JSON to One Line" converts a pretty-printed, multi-line JSON document into a compact single-line string by removing all unnecessary whitespace — spaces, tabs, and newlines — while keeping the structure and values identical.
This is the same as calling JSON.stringify(JSON.parse(input)) in JavaScript with no indentation argument. The result is the smallest valid JSON string for that data. It is widely used to minify JSON before embedding it in HTTP request bodies, config strings, environment variables, or any context where size matters.
How to Use JSON to One Line
Paste your formatted JSON into the input area or click "Load Sample"
The one-line output appears instantly on the right
The size stats show the original size, compressed size, and bytes saved
Copy or download the minified output
Common Use Cases
- Developers minifying JSON payloads before including them in HTTP request bodies.
- DevOps engineers storing JSON config as a single-line environment variable.
- Backend engineers embedding JSON in shell scripts or command-line arguments.
- Front-end developers minimizing JSON for inline <script> data islands.
- API engineers reducing bandwidth by removing whitespace from JSON responses.
Example Input and Output
A formatted 4-line JSON object is compressed to a single line.
{
"name": "Alice",
"age": 30,
"active": true
}{"name":"Alice","age":30,"active":true}Privacy
All processing runs in your browser. No data is uploaded to any server.

