About HTML minification
An HTML minifier removes unnecessary characters from HTML — comments, extra whitespace and line breaks — without changing how the page renders. Smaller HTML downloads faster and improves page-speed scores. Paste your HTML, minify it, and copy the compact result. It runs entirely in your browser.
How HTML Minify works
How to minify HTML
- Paste your HTML in the box above.
- Click minify to strip comments and collapse whitespace.
- Copy the smaller HTML into your page or build.
What gets removed
Comments, redundant whitespace and line breaks between tags are removed while preserving content inside elements like <pre> and <textarea> where spacing matters.
Why minify
Less code means smaller downloads and faster rendering — useful for performance and Core Web Vitals. Keep an unminified copy for editing.
What minification removes
| Removed | Preserved |
|---|---|
| Comments | All visible content |
| Extra whitespace & line breaks | Spacing inside <pre> and <textarea> |
| Indentation between tags | Tags, attributes & structure |
For the smallest transfer, serve the minified file with gzip or Brotli compression enabled on your server — minification and compression stack together.
Common uses
- Shrink HTML for faster page loads
- Improve PageSpeed and Core Web Vitals
- Reduce bandwidth usage
- Prepare HTML email for sending
- Minify output before deploying
- Compare original vs minified size
- Clean up generated HTML
- Optimise static pages