Free Online HTML Minifier
An HTML minifier strips comments and collapses whitespace between tags to shrink a page's byte size, while preserving content inside pre and textarea elements.
Your data is processed entirely in your browser and never sent to any server.
How to Use This Tool
- Paste your HTML into the input box.
- Read the minified markup in the output box.
- Compare the original and minified byte counts shown above it.
- Copy the smaller markup for production; pre and textarea stay untouched.
What Is a HTML Minifier?
Browsers ignore most insignificant whitespace between block-level tags, and they never display HTML comments, so both can be removed without changing how a page renders. Trimming them reduces the number of bytes sent over the wire, which speeds up downloads and, combined with gzip or Brotli, improves Core Web Vitals like Largest Contentful Paint.
This minifier removes comment nodes and collapses runs of whitespace that sit between elements. Crucially, it leaves whitespace inside whitespace-significant elements — pre and textarea, where the CSS white-space property and the HTML spec say spacing matters — exactly as written, so code samples and pre-formatted text survive intact.
Typical savings run 10–30% depending on how much the original was indented and commented. The tool shows the before and after byte counts so you can confirm the reduction. Use it as a final step before deploying static HTML. Minification runs locally, so your markup never leaves the browser.
Frequently Asked Questions
What exactly gets removed?
How much smaller will my file be?
Is minified HTML safe to ship?
Published by the WeGotEveryTool team. We build and test every tool in-house and update pages when the underlying spec, formula, or recommendation changes.
Reviewed: May 2026. Disclaimer: this tool is provided as-is for general informational use. For decisions with material consequences (medical, legal, financial, security) verify results against a qualified professional source.
Related Web & HTML
Paste HTML and see it rendered live in a sandboxed iframe, with the source side by side. Nothing is uploaded.
Strip tags from HTML and get clean, readable plain text with sensible line breaks for block elements.
Turn plain text into safe HTML — escape special characters and wrap lines in paragraphs or line breaks.
Pick rows and columns, fill the cells, and copy clean HTML table markup with a live preview as you type.
Turn one item per line into an ordered or unordered HTML list, with a live preview and copy-ready markup.