HTML Minifier

Minify HTML code by removing unnecessary whitespace.

Make HTML smaller by removing comments, unneeded whitespace between tags and empty class or style attributes. Paste HTML and get a compact version with the size saving shown. Whitespace inside pre, textarea, script and style elements is kept, so code blocks and form text look the same. It's useful for email templates, embedded snippets and static pages where every kilobyte counts.

Common use cases

  • Shrink an HTML email template under a size limit
  • Minify a widget or snippet before embedding it
  • Reduce the size of a static HTML page
  • Strip comments before sharing HTML

How to use

  1. Paste your HTML.
  2. Choose whether to remove comments and empty attributes.
  3. Copy or download the minified HTML.

FAQ

Will minifying break my page?

Rarely. Spaces between inline elements can matter for layout, so check the result. Conditional comments for old Outlook versions (<!--[if mso]>) are kept even when other comments are removed.

Does it minify inline CSS and JavaScript?

No. Use the CSS minifier and JS minifier for those.

How do I make HTML readable again?

Use the HTML formatter.