HTML Minifier
Client-side HTML minification with live output and byte-savings stats.
How to use
Paste HTML into the input pane. The minified output appears on the right as you type (300ms debounce).
Toggle options to control what gets stripped: whitespace, comments, attribute quotes, empty attributes. Inline <style> and <script> blocks can be minified in place.
Keyboard shortcuts
Two shortcuts:
| Cmd / Ctrl + K | Focus the input pane |
| Cmd / Ctrl + Enter | Copy output to clipboard |
When to use it
HTML minification saves bytes on static pages, email templates, and generated markup.
- Prepping a static HTML file for a CDN drop without a build pipeline.
- Cleaning up template output to see the actual bytes shipped.
- Compressing HTML email templates before sending.
- Quickly checking how small a snippet becomes.
When not to use: If you have a build pipeline (Next.js, webpack, Vite), it already minifies HTML output in production. This tool is for one-offs.
Options
Collapse whitespace — runs of spaces, tabs, and newlines become a single space. Off preserves formatting exactly.
Remove comments — strips all HTML <!-- ... --> comments. Conditional comments (<!--[if IE]>) are also removed.
Unquote attrs — class="foo" becomes class=foo when the value contains no special chars.
Remove empty attrs — drops attributes with empty string values.
Minify CSS — collapses whitespace and comments inside <style> blocks.
Minify JS — same for <script> blocks. Uses terser internally.
Format-specific gotchas
Whitespace can be meaningful. Inside <pre> and <textarea>, whitespace is preserved automatically. Between inline elements (<span>A</span> <span>B</span>), the space you rendered may matter — collapse can change layout. Test after minifying.
Attribute quotes matter more than they look. The tool only unquotes values that are safe to unquote. Values with spaces, quotes, or reserved chars stay quoted.
Conditional comments go too. If you need <!--[if IE]>-style comments for legacy browsers, turn off "Remove comments."
The library loads on first use. The minifier is dynamic-imported, so the first minify has a brief delay while it downloads. Subsequent runs are instant.
Privacy
Everything runs in your browser. Your HTML never leaves the page — no server, no logging, no analytics on the content.