HTML Minifier

Paste your HTML and shrink it in one click. This minifier strips comments and collapses unnecessary whitespace, then shows the original size, the minified size and the percentage saved — all in your browser, nothing is uploaded.

Your result will appear here

Minified HTML

Original size
—
Minified size—
Saved—

Content inside <pre>, <textarea>, <script> and <style> tags is left untouched so your code and preformatted text keep working exactly as before.

How to use

  1. Paste your HTML into the box above.
  2. Choose whether to remove comments and collapse whitespace, then click Minify HTML.
  3. Copy the result or download it as a .html file and use it on your site.

Frequently asked questions

What does an HTML minifier do?

It removes parts of your HTML that browsers do not need: comments, line breaks and extra spaces between tags. The page looks and works the same, but the file is smaller and downloads faster.

Is it safe to minify my HTML?

Yes. This tool never touches the content inside <pre>, <textarea>, <script> and <style> tags, where whitespace can change what the page shows or how code runs.

Will minifying break my page?

No — minified HTML is still valid HTML. Browsers ignore the whitespace that is removed. Keep a copy of your original file though, because minified code is hard to read and edit by hand.

Does my HTML leave my device?

No. Minification runs entirely in your browser with JavaScript. Nothing is uploaded to any server.

Related tools