Code Minifier
Minify JavaScript, CSS, HTML, SVG and JSON to reduce file sizes.
How Code Minifier Works
What is Code Minification?
Minification removes unnecessary characters from source code without changing its functionality: whitespace, comments, line breaks, and redundant syntax.
This reduces file sizes significantly, leading to faster page loads and lower bandwidth usage.
How to Use
- Pick a language, or leave it on Auto, which tells JavaScript, CSS, HTML, SVG and JSON apart by the code itself.
- Paste or type the code. The minified output updates as you type.
- Code that cannot be parsed is not minified. The error is shown instead, with its line and column where the minifier reports them.
- The size line shows how much smaller, or larger, the output is.
- The dice loads example code: for the selected language, or for any language in Auto.
Supported Languages
| JavaScript | Terser: removes whitespace and comments, drops dead code and shortens local names. Licence comments starting with /*! are kept |
| CSS | csso: removes whitespace and comments, merges rules and shortens values and colours. /*! comments are kept. Nested rules are not supported and are refused rather than dropped |
| HTML | html-minifier-terser: collapses whitespace, removes comments and minifies inline CSS and JavaScript. <pre> and conditional comments are kept |
| SVG | SVGO: shortens path data and colours and removes metadata, comments and editor leftovers. viewBox, ids and <title> are kept |
| JSON | Removes whitespace outside strings. Values, numbers and key order stay exactly as written |
Important Notes
- Each minifier loads the first time its language is used, so the first result takes a moment.
- Always test minified code before deploying to production.
- Minification is not obfuscation. The code can still be reverse-engineered.
- Keep your original source files. Minified code is not meant to be edited.
Privacy & Security: All minification runs entirely in your browser. No code is sent to any server.
Language