About HTML Minifier
Minification removes characters a browser does not need, such as comments, indentation, and line breaks, to make files smaller to download. This tool uses simple pattern rules. For CSS it strips comments, collapses whitespace, and drops the last semicolon in each block. For HTML it strips comments except conditional ones, removes whitespace between tags, and collapses repeated spaces. It does not shorten names, merge rules, or minify inline scripts.
How to use HTML Minifier
- Type or paste into the "Code" box, or press "Use example" to try it with sample data.
- Set "Language" if the defaults do not fit.
- The result appears below and updates as you type.
- Copy the result with the copy button, or download it as a file where that is offered.
Questions about HTML Minifier
Is it safe to minify HTML that contains pre or textarea elements?
Be careful. The HTML mode collapses runs of whitespace everywhere, including inside pre and textarea elements and inline scripts, where spacing can matter. Check those parts of the output, or minify pages that do not use them.
Runs in your browser. Page last updated .