What Gets Removed
- HTML comments (
<!-- ... -->) - Extra whitespace and blank lines
- Whitespace between tags
- Leading/trailing whitespace per line
<!-- ... -->)Minified HTML downloads faster and uses less mobile data. The HTML Minifier strips runs of whitespace and removes comments while leaving the contents of <pre>, <textarea>, <script> and <style> blocks alone, so layout, code and pre-formatted text survive the round trip. Conditional comments for legacy IE (<!--[if IE]-->) are also preserved, since those still carry meaning for the browsers that read them.
Minification happens in your browser using a small set of regex passes: collapse whitespace between tags, drop comments, trim leading/trailing space inside tags, and tighten attribute spacing. Crucially, the algorithm walks past <pre>, <textarea>, <script> and <style> blocks without touching their contents — those tags hold whitespace-sensitive content. The output is byte-counted against the input so you can see exactly how much you've saved before copying.
<pre>, <textarea>, <script>, <style> contentsHand-written HTML with normal indentation typically shrinks 15–30%. Generated HTML from a templating engine often saves more — 30–50% — because it carries more whitespace per tag. The tool reports the exact byte count and percentage so you can see the saving.
No, as long as the HTML is well-formed. The minifier preserves the contents of <pre>, <textarea>, <script> and <style> tags so layout and code aren't damaged. It also leaves IE conditional comments (<!--[if IE]-->) intact, since those carry meaning for old browsers.
For static pages or one-off uploads, paste-and-copy is fine. For projects with templating, use a build-step minifier (html-minifier-terser, esbuild) so the source stays readable in version control and minification is automatic on deploy.
<style> and <script> tags?No — only the surrounding HTML structure is minified. Inline CSS and JS are left untouched so they keep working exactly as written. Run a dedicated CSS or JS minifier first if you need those compressed.
Pair with the HTML Prettifier when you need to read the output again, or with the CSS Minifier and JavaScript Minifier for full asset compression.