HTML Minifier (Compress HTML)
How to Use
Paste HTML and the tool emits a compressed version with whitespace, newlines, and comments removed. The contents of `<pre>`, `<script>`, `<style>`, and `<textarea>` are preserved by default so embedded code and pre-formatted text aren't damaged. Original / minified sizes and the savings percentage are shown.
What HTML Minification Does
Indented HTML is readable but wastes bytes on the wire. **Minifying at build time reduces transfer size** without changing rendering. This tool stays on the safe side — it doesn't strip quote marks from attributes or aggressively rewrite content. For production builds with full optimization (attribute quote elision, entity normalization, etc.), use `html-minifier-terser`.
Use Cases
- Reducing HTML size before deploying a static site
- Compacting email templates (less work for email clients)
- Compressing template-engine output (EJS, Handlebars, etc.)
- Inlining HTML into data attributes without bloat
- Reducing complex HTML to a single line for logging
Privacy
Minification happens entirely in the browser; the HTML never leaves your device. Safe for internal templates or content with personal data.