Skip to content
🗜️

HTML Minifier

Shrink markup by collapsing layout whitespace and removing the attributes a browser ignores anyway. Content inside pre, textarea, script and style is left alone, and every removal is optional.

Drop an .html file here or click to browse

Paste markup and press Minify.

Whitespace only collapses where HTML treats it as layout: between block elements and around tags. A single space between words and around inline elements such as <a>, <span> and <button> is kept, because removing it would join the words together. Bodies of <pre>, <textarea>, <script> and <style> are never collapsed, and conditional comments such as <!--[if IE]> are always preserved. Quote removal only happens for values that stay valid without them.

What Is HTML Minifier?

The HTML Minifier walks the document with the same parser as its beautifier sibling, collapses layout whitespace between tags, drops redundant type attributes, and removes only what you tick off: ordinary comments (conditional comments always stay), quotes around values that do not need them, empty attributes and the optional slash on void tags. Content that is whitespace sensitive or executable, including script, style, pre and textarea interiors, is left alone, so the page keeps behaving the way it did.

Who Uses the HTML Minifier?

Publishers and developers shave bytes off a template before it goes to production, and anyone fighting a size limit on an email or an embed needs that headroom.

How to Use the HTML Minifier

  1. Paste the markup and choose which reductions are allowed.
  2. Press Minify and read the saved bytes and percentage in the result line.
  3. Download the minified file, keeping the original for debugging.

Why Choose Our HTML Minifier?

  • Option-driven, so nothing is removed that you have not approved
  • Script, style, pre and textarea bodies are left verbatim
  • Reports exact bytes saved, so the gain is measurable rather than guessed

Try the HTML Minifier above — it is free, fast, and works on any device. Bookmark this page to return whenever you need it.