Code Minifier
Shrink HTML, CSS, and JavaScript by stripping comments and collapsing whitespace — with before-and-after sizes so you see the saving.
What is Code Minifier?
The Code Minifier reduces the size of source code without changing what it does. For HTML it removes comments and the whitespace between tags; for CSS it strips comments and the spaces around braces, colons, and semicolons; for JavaScript it removes block comments, line comments, and unnecessary whitespace.
The tool shows the original size and minified size side by side, so the benefit is concrete: a 4 KB stylesheet typically drops 20–30% from whitespace and comments alone.
This is whitespace-and-comment minification — it does not rename variables or restructure logic the way heavy build-tool minifiers (Terser, esbuild) do. That makes it predictable and safe for snippets, while big applications should still minify in their build pipeline.
Why is Code Minifier Useful?
Smaller files load faster, and page speed affects both user experience and Google rankings. For sites without a build step — WordPress custom CSS boxes, landing page builders, embedded widgets — this tool is the missing minify button: paste the readable source, ship the compact version.
Email templates are a strong use case too. Some email clients clip messages over a size threshold (Gmail clips at 102 KB), and minifying the HTML is often what gets a heavily styled template back under the limit.
It's also handy for inline snippets: minified CSS or JS pasted into a tag manager or a CMS field is less likely to be mangled by editors that reformat multi-line input.
How to Use Code Minifier
1. Paste your HTML, CSS, or JavaScript into the input box and pick the matching language.
2. Run the minifier and compare the original and minified sizes.
3. Copy or download the compact output.
4. Keep your readable source somewhere safe — minified code is for shipping, not editing.
Example
Input (CSS):
/* main button */ .button { color: red; margin: 0 auto; }
Output:
.button{color:red;margin:0 auto}
Keep going
Related tools
More utilities that pair well with this one.
FAQ
Questions, answered
Everything you need to know about the Code Minifier.
Yes — free for HTML, CSS, and JavaScript alike.
