HTML Minifier

Shrink HTML markup by removing comments and collapsing whitespace — while <pre>, <textarea>, <script> and <style> content is left byte-for-byte intact.

Paste HTML and press Minify.
Before0
After0
Saved0%

How to use the HTML Minifier

Paste your HTML into the input box, or click Sample to load a demo document with a <pre> and a <script> block.

Choose whether to remove comments and collapse whitespace — protected regions are always skipped.

Click Minify to see the before/after size and percentage saved, then Copy or Download the result.

Frequently asked questions

Will minifying change how my page looks?

Usually not. Collapsing whitespace can merge a significant space between inline elements, which is why pre, textarea, script and style blocks are left completely untouched. Always spot-check inline spacing.

Are HTML comments always removed?

Only when the Remove comments option is ticked, and comments inside pre, textarea, script or style blocks are never removed because those regions are protected.

How much space will I save?

The tool reports the before and after sizes plus the percentage saved. Typical hand-written pages shrink by roughly 10 to 25 percent.

Related tools