📦 HTML Minifier
Minify HTML by removing comments, extra whitespace, and optional CDATA. Reduce file size instantly — all in your browser, no upload.
About the HTML Minifier
This HTML minifier runs entirely in your browser. Paste your HTML, choose the options you want, and click Minify to get a smaller version instantly. Nothing is uploaded to a server — all processing happens with JavaScript on your device.
Options explained
- Remove comments — Strips
<!-- ... -->comment blocks that are not needed at runtime. - Collapse whitespace — Replaces runs of whitespace (spaces, tabs, newlines) with a single space and removes whitespace between tags where it is not significant.
- Remove optional quotes — Removes quotes from attribute values that contain only safe characters (letters, digits, hyphens, underscores).
How to use the minifier
- Paste your HTML into the input box.
- Tick the options you want to apply.
- Click Minify to produce the compressed output.
- Check the stats line to see the original size, minified size, and percentage saved.
- Click Copy to copy the minified HTML, or Clear to start over.
Frequently asked questions
Will minification break my page? Whitespace and comment removal are safe for standard HTML. Use the optional-quotes option with care, since some attribute values need quotes.
Does this handle inline <style> or <script> blocks? The minifier focuses on HTML structure. Inline CSS and JS are preserved as-is; use a dedicated CSS or JS minifier for those.
Is my HTML uploaded anywhere? No. Everything runs locally in your browser.