How to minify JSON
- Paste your JSON into the box above.
- Read the minified output that appears right away.
- Check the saving in characters and as a percent.
- Fix any error the tool reports before you copy.
- Copy the result or download it.
What this JSON minifier gives you
- Removal of every space, tab and line break between items.
- A validity check that reports broken input and never mangles it.
- The exact saving as a number and a percent.
- Key order and array order kept exactly.
- Text inside strings kept exactly with its inner spaces.
- All work done in your browser with no upload.
What does a JSON minifier do?
Whitespace in JSON exists for people. Machines ignore it completely. So every space and line break in a payload is bandwidth spent on nothing.
A typical indented document is about a third larger than its minified form. Deeply nested ones can be half again as large. One request will never feel the difference. An API that serves millions of responses will. So will a config file that loads on every page view. The saving turns into real money and faster pages.
When to use a JSON minifier
- API responses that a front end fetches again and again.
- Config data inside a web page or a JavaScript bundle.
- Values stored in a database column with a length limit.
- Data sent to phones over slow or metered connections.
- Data passed in a URL where encoding doubles the cost of each character.
When not to minify JSON
Keep files that people edit in their readable form. A minified config file is a file nobody can review. The saving means nothing for a file read once at startup.
The same goes for test data and anything in version control. A minified file makes a one line diff. That diff hides what actually changed.
Does gzip make a JSON minifier pointless?
Not pointless, just less dramatic. Most servers compress responses with gzip or brotli. Whitespace compresses very well because it repeats so much. So compression already removes much of the gain in transit.
| Setup | Benefit of minifying |
|---|---|
| Stored in a database | High |
| Sent without compression | High |
| Passed in a URL | High |
| Served with gzip or brotli | Small but real |
What minifying does not change
The data stays identical. Key order stays. Arrays keep their order. Text inside strings keeps its spaces. The minified document parses to exactly the same value.
Number style is the one exception. The tool writes numbers in standard form. So 1.50 becomes 1.5 and 1e3 becomes 1000. A parser sees those as the same numbers anyway. Does the written form matter to you? Store the value as a string.
A smart JSON workflow
- Keep the readable version as your source file.
- Edit and review that file in version control.
- Minify a copy as part of your build or before you ship it.
- Format a copy again with the JSON formatter whenever you need to read it.
Common JSON minifier questions
The tool says my JSON is invalid
The minifier checks syntax first. Find the error with the JSON validator. Then minify again.
My saving looks small
Your JSON was already compact. Or most of its size sits inside long string values. Whitespace removal cannot shrink those.
Tips for a safe JSON minifier workflow
- Never edit the minified copy by hand.
- Check the saving to spot files that gain little.
- Validate the result once more in the tool that reads it.
- Keep large text values short since whitespace removal cannot touch them.
- Name minified files clearly such as config.min.json.
A clear name tells teammates which file to edit. People waste time when they change the minified copy by mistake. The next build then wipes their work.
How the JSON minifier keeps data safe
The tool parses your JSON first. Then it writes the value back out with no spaces. This method never touches text inside strings. A simple search and replace would break strings that hold spaces. A real parser avoids that trap.
Who uses a JSON minifier?
Front end developers shrink configs. API builders trim responses. Mobile teams cut data use. Database admins fit values into size limits.
Your data stays private
The tool works in your browser and uploads nothing. Need to shrink other code too? Try the CSS minifier, the HTML minifier or the JavaScript minifier.