Advertisement
HTML Minifier
Shrink HTML by removing whitespace and comments — and see exactly how many bytes you save.
Advertisement
How to Use This Tool
Paste your HTML, optionally keep comments, then minify. Copy the compact version into your build.
- This is a simple whitespace/comment minifier — always test pages that rely on formatting, such as
<pre>blocks. - For production, pair this with Gzip/Brotli compression on your server.
Frequently Asked Questions
Is minified HTML safe?
Yes for whitespace removal. Removing conditional comments or whitespace-sensitive content (like <pre>) could change rendering — always test.
Why is <pre> content kept?
Preformatted text and textarea content display whitespace literally, so collapsing it would change the visible output.
How does minification help performance?
Smaller files download and parse faster. Combined with compression, savings are typically 30-50% on HTML.
Is my HTML uploaded?
No — minification runs entirely in your browser.
Practical Example
Minify this snippet (49 bytes):
<!-- note -->
<div>
<p>Hello World</p>
</div>
The output (29 bytes) drops the comment and collapses whitespace:
<div><p>Hello World</p></div>
- You save 20 bytes, about 41%, with no change to how the page renders.
What Your Results Mean
- Saved bytes — the difference between the original and minified sizes; smaller HTML downloads and parses faster.
- Savings percent — the proportion of the file removed, typically 30-50% on hand-formatted HTML.
- Removed comments —
<!-- ... -->blocks are deleted when the option is on, shrinking the file without affecting content.
Trusted Sources
Advertisement