Strip comments and extra whitespace from HTML to shrink its size. Content of pre and script is left alone.
No sign-up, no fees.
Removes comments and extra whitespace from HTML.
Can also minify CSS inside <style>.
Leaves <pre>, <textarea> and <script> content alone.
Shows how many bytes you saved.
What you type is processed, but never shared with anyone.
How to use the HTML minifier
You want your page to load faster or your email template to be lighter. Three steps:
Paste the HTML. Put your page or a snippet into the HTML code box.
Set the options. Turn on or off removing comments, collapsing whitespace and minifying the CSS inside <style>.
Copy. The minified HTML and the size you saved appear below; take it with Copy.
What is HTML minifying?
The indentation, line breaks and comments in an HTML file make code easier to read but aren't needed by the browser. Minifying removes them and brings the file down to fewer bytes. A smaller file downloads faster, which matters on mobile connections and for email templates. The way the page looks and works should not change.
What you need to know
Inline spacing is kept: the single space between <b>a</b> <i>b</i> isn't removed, otherwise the words would run together.
Block tags are tidied: whitespace next to tags like <div>, <p> and <li> is removed.
Left alone: whitespace inside <pre> and <textarea> is meaningful and stays; <script> content also stays as it is.
Conditional comments (<!--[if IE]>) are kept.
This tool doesn't minify JavaScript; only HTML and CSS inside <style>.
Tips
Before you publish the minified file, open the page once in a browser and check nothing broke.