HTML Minifier
Instantly minify HTML by removing unnecessary whitespace and comments, right in your browser.
Paste your HTML below to instantly minify it - entirely in your browser, nothing is sent to our servers.
More Website Tools
View all 19JustChecker builds tools that respect your data - this one never leaves your browser.
What Is the HTML Minifier?
It removes comments and unnecessary whitespace from HTML to make it smaller. It runs in your browser.
When to Use It
- For static pages, email templates or embed snippets where size matters.
- To compact HTML before pasting it into a CMS field.
How to Use It
- Paste your HTML.
- Minify and copy the output.
Understanding the Result
Rendering stays the same in normal cases. Content inside <pre> and <textarea> is sensitive to whitespace, so check those parts.
Limitations
Server-side compression usually saves more than minification. For CSS and JavaScript use the Code Minifier or JavaScript Minifier.
Example
<!-- main navigation -->
<nav class="menu">
<a href="/">Home</a>
<a href="/tools">Tools</a>
</nav>
becomes:
<nav class="menu"><a href="/">Home</a> <a href="/tools">Tools</a></nav>
The comment and the indentation around the block-level <nav> tag are removed, while the single space between the two links is kept - so they still render with a gap between them, exactly as before.
Where It Helps Most
- Email templates - some email clients, notably Gmail, clip messages over about 102 KB, so smaller HTML helps the whole email show.
- Embed codes and widgets that other people paste into their sites.
- CMS fields that add unwanted
<br>tags when they see line breaks.
What to Check Afterwards
- Text inside
<pre>,<textarea>and code samples, where spaces matter. - Elements that CSS turns into inline or inline-block boxes, such as a
<li>styled as a horizontal menu - the space between them is removed like any other block tag. - Conditional comments used by old Outlook email templates.
For CSS and JavaScript, use the Code Minifier and JavaScript Minifier. See how compression compares in our guide to speeding up a website.
Frequently Asked Questions
Explore More Tools
Keep going with related categories and our most used tools.