HTML Minifier
Remove comments and extra whitespace from HTML to make pages lighter.
Runs entirely in your browser. Nothing you enter is uploaded.
How to use
- Paste your HTML.
- Choose whether to remove comments.
- Press Minify.
- Copy or download the result and compare the size.
Example
A 40 KB template with indentation and comments can drop by 10 to 25 percent after minifying, before gzip.
About this tool
The minifier collapses runs of whitespace and removes whitespace between tags. Content inside pre, textarea, script and style tags is left untouched, and conditional comments are kept. Always test the result on your page.
Frequently asked questions
Will minifying break my page?
It is designed to be safe, but whitespace can matter between inline elements. Check the result visually before using it.
Does it minify CSS and JavaScript inside the page?
No. Inline style and script blocks are left unchanged. Use the CSS Minifier for styles.
Is gzip better?
They work together. Minify first, then let your server compress the file with gzip or Brotli.