Reduce repeated whitespace inside HTML tags while preserving text spacing, quoted values and raw-text content.
How to use the HTML minifier
- Paste compiled HTML, up to 500,000 characters.
- Keep comments unless you know they are unnecessary for your application.
- Select Minify HTML, compare the output and copy it.
Copy Output always processes the current input first. Pasted markup is shown as text, not rendered as a preview.
What this minifier changes
By default, this tool collapses repeated spaces, tabs and line breaks inside tags, outside quoted attribute values. It keeps whitespace between elements and within text because removing it can join words or change layout. Comments are preserved unless you enable the optional removal setting.
Test the output in your application before deployment. This is conservative cleanup, not a full HTML validator or production bundler. Templates and legacy script escaping are rejected; JavaScript and CSS are not minified. With comment removal enabled, conditional comments and common WordPress, license and server-directive markers are retained, but other application-specific comments can be removed.
The HTML is processed locally by the page script and is not uploaded by this tool.
Why might the reduction be small?
Already compact tags may produce no savings. Text-node whitespace is deliberately retained, including indentation between tags, because CSS and inline elements can make it meaningful. The displayed counts are JavaScript string lengths, not transferred file sizes or compressed bytes. See MDN’s whitespace guide for rendering examples.