When to use the JSON Minifier
Smaller API payloads
Remove whitespace from JSON sent over the network to save bandwidth.
Embedding data in HTML
Minify JSON-LD structured data or app configuration before placing it in a page.
Environment variables
Store a JSON value on a single line in a .env file or CI setting.
Storage
Keep large exported datasets smaller on disk or in a database column.
Message queues and logs
Single-line JSON is the standard format for many log systems (JSON Lines), where each line must be one complete record.
Features and benefits
- Validates before minifying, never outputs broken JSON
- Keeps spaces inside string values intact
- Shows bytes saved
- Download as .json
- Keeps long numbers, decimals and key order exactly as written
- Open or drop a .json file, nothing is uploaded
- Shows the gzip size of the result
- Escape the result as a string for code
Example
{
"debug": false,
"retries": 3
}{"debug":false,"retries":3}How the JSON Minifier works
ConvertNest parses the JSON first, so broken input is never minified into something worse. It then removes only the spaces, tabs and line breaks between tokens, copying every key, string and number character for character, so long IDs and decimals such as 1.50 stay exactly as written. Spaces inside string values are part of your data, so they are kept exactly as they were. The output panel shows the original and minified sizes and the percentage saved.
A real-life example
A marketer adds product structured data to a landing page and the CMS field has a strict length limit. The formatted JSON-LD is 3.1 KB because of indentation. After minifying, it is 2.2 KB, about 29% smaller, and fits in the field. Because the minifier validates first, she also knows the structured data is syntactically correct before testing it in Google’s Rich Results Test.
Good to know
Minifying is the reverse of formatting. It removes only the whitespace between tokens; the data is exactly the same. Text inside strings, including spaces, is never touched.
One-line JSON is handy when a value must fit into a single environment variable, a command-line argument or a CSV cell. For network traffic, gzip or Brotli compression on the server usually saves far more than minifying alone, but the two work well together.
Why your numbers stay exact here
Many online minifiers read your JSON into JavaScript and write it back out. That quietly changes some values: a long ID such as 12345678901234567890 becomes 12345678901234567000, 1.50 turns into 1.5, and keys that look like numbers can be moved to the front.
ConvertNest checks that your JSON is valid, then removes only the whitespace between values. Every key, string and number is copied character for character, so the compact version means exactly the same thing as your original, in the same order.
{"id": 12345678901234567890, "price": 1.50}
→ {"id":12345678901234567890,"price":1.50}
Minify, gzip and compact JSON, what saves the most
Compact JSON is simply the same data on one line with no extra spaces. Minifying usually saves 10% to 40%, depending on how much indentation the file had. Web servers then compress responses with gzip or Brotli, which shrinks repeated key names much further, so the tool also shows the gzip size of your result.
| Step | What it removes | Changes the data? |
|---|---|---|
| Minify | Spaces, tabs and line breaks between values | No |
| gzip or Brotli | Repeated text, done by the web server | No, the browser undoes it |
| Shorter key names | Characters in every key | Yes, your code must change too |
To make minified JSON readable again, paste it into the JSON Formatter.
Tips for the best results
- Keep a formatted copy for editing and only minify the version you ship.
- Servers that use gzip or Brotli compress whitespace well, so minifying matters most where compression is not used.
- Download the .json file to avoid copying errors with very long lines.
- Use the JSON Formatter to turn minified JSON back into readable JSON.
- When posting JSON in a chat app that wraps long lines, share the formatted version instead, minified text is hard for others to read.
Common mistakes to avoid
Minifying JSON with comments
Comments make the input invalid. Remove them first.
Editing minified files by hand
A single long line is easy to break. Format, edit, then minify again.
Expecting huge savings on compact data
Data that is already on one line has nothing to remove.
JSON Minifier, frequently asked questions
Does minifying change my data?
No. Only whitespace between keys and values is removed.
How much smaller will my JSON get?
Indented JSON often shrinks by 15 to 40%, depending on how deeply nested it is.
Can I turn minified JSON back into readable JSON?
Yes, paste it into the JSON Formatter.
What happens if my JSON is invalid?
You will see the error with its line and column, and nothing is output until it is fixed.
Is minified JSON still valid JSON?
Yes. It is exactly the same data with the optional whitespace removed.
Does the order of keys change?
No. Keys stay in their original order.
Should I minify JSON files in my code repository?
Usually not. Keep readable JSON in version control so changes are easy to review, and minify only the copy that is deployed or sent over the network.
Is minified JSON faster to parse?
Slightly, because there are fewer characters to read, but the main benefit is a smaller download. For most apps the difference in parsing time is too small to notice.
What is compact JSON?
Compact JSON is the same data written on one line with no extra spaces. It is what this tool produces, and it is the usual form for API requests, environment variables and data stored in databases.
Will minifying change long numbers or decimals?
No. The tool removes only whitespace, so long IDs such as 12345678901234567890 and decimals such as 1.50 stay exactly as written.
What does “Escape as a string for code” do?
It wraps the minified JSON in double quotes and escapes the quotes and backslashes inside, so you can paste it straight into a string in JavaScript, Python, Java or C#.
Can I minify a .json file without copying it?
Yes. Click “Open .json file” or drop the file on the input box. The file is read in your browser and is never uploaded.