HTML Minifier
Compress HTML by removing comments, collapsing whitespace, and removing optional closing tags.
Compress HTML by removing comments, collapsing whitespace, and removing optional closing tags.
Paste your HTML into the input area and click "Minify HTML." The tool removes HTML comments, collapses consecutive whitespace into single spaces, and strips optional closing tags like </li>, </p>, and </td>. The compressed output and percentage savings appear instantly.
HTML documents contain indentation, comments, and optional tags that browsers do not need. Removing these reduces document size, speeds up the initial page render, and decreases time to first byte when serving pages. For high-traffic sites, even small HTML savings translate to significant bandwidth reduction over millions of requests.
<!-- ... -->)The minifier is careful to preserve content inside <pre>, <code>, <script>, and <style> blocks where whitespace matters. It only collapses whitespace between regular HTML tags. Always test the minified output to ensure your page renders correctly.
Everything runs in your browser. No HTML is uploaded to any server, so your markup remains private. This tool works offline once the page is loaded and is perfect for quickly compressing HTML snippets, email templates, or static pages.