HTML minifier

Shrink HTML by collapsing whitespace and dropping comments — safely, without touching scripts, styles, or attribute values.

Minified in this browser. Nothing is sent anywhere.

Collapses whitespace outside tags, drops comments (legacy `<!--[if …]>` conditional comments are kept), and preserves `<script>` `<style>` `<pre>` `<textarea>` contents verbatim. Whitespace between inline elements is kept as a single space so text spacing stays correct. Attributes are never altered.

How to use

  1. Paste the HTML.
  2. Minify and see the byte savings.
  3. Copy or download the result.

What it supports

Preserves script/style/pre/textarea contents and keeps a space between inline elements so text spacing stays right. Legacy conditional comments are kept. It does not rewrite attributes or shorten class names. Up to 300,000 characters.

Related tools

Related guides