Developer Tools

HTML Minifier

Shrink HTML by stripping comments and whitespace, with before/after size comparison.

Paste HTML and press Minify to see size savings.

What is an HTML minifier?

HTML minification removes everything a browser does not need to render a page: comments, and whitespace between tags and inside text runs. The result is byte-for-byte equivalent markup that downloads faster — meaningful for landing pages where every kilobyte affects load time and SEO. This minifier is careful where it matters: the contents of <pre> and <textarea> elements are protected and restored untouched, since whitespace there is significant, and it reports the before/after size so you can see exactly what was saved.

How to use this tool

  1. Paste your HTML source into the input box.
  2. Press Minify — comments are stripped, whitespace between tags is collapsed, and repeated spaces become one.
  3. Check the size-savings card showing original bytes, minified bytes, and the percentage saved.
  4. Copy the output or download it as an .html file, and test the page renders identically before deploying.

Key features

Common use cases

Practical tips

Frequently Asked Questions

Will minifying break my page?
Almost never for normal markup. Whitespace between block elements is insignificant in HTML, and this tool protects pre and textarea content where whitespace matters. Still, always test the minified page before deploying.
Are HTML comments removed?
Yes, all <!-- --> comments are stripped, which also removes any notes or TODO comments you left in the source — another reason to keep the original file.
How much smaller does HTML typically get?
Hand-written HTML with indentation often shrinks 15–30%. Machine-generated HTML with heavy nesting can shrink more. The tool shows your exact saving.
Does it protect pre and textarea elements?
Yes. Their entire contents are extracted before minification and restored unchanged, because whitespace inside them is significant and visible.
Is my HTML uploaded anywhere?
No. Minification runs entirely in your browser with JavaScript, so private or unreleased markup never leaves your device.