HTML Minifier

Remove whitespace, comments, and blank lines from HTML to reduce file size for production.

Web developers reducing HTML payload size before deploying to production servers.

How to use it

  1. Paste your HTML

    Copy your HTML markup and paste it into the editor.

  2. Click Minify

    Whitespace, blank lines, and comments are stripped instantly to produce compact markup.

  3. Copy the minified HTML

    Copy the output into your production build, template, or CDN upload.

Why use this tool?

The HTML you write is full of things that help you and mean nothing to a browser: indentation, blank lines between sections, and comments explaining the markup. The browser downloads every one of those bytes anyway. On a high-traffic page or an email template sent thousands of times, that wasted weight adds up — slowing the first byte and the render, and costing bandwidth. This minifier strips the readability overhead — collapsing whitespace and removing comments and blank lines — to produce the smallest functional HTML, typically 10–30% lighter. Paste your markup, click minify, and copy the output for your production build, template, or CDN. It runs entirely in your browser, so your markup never leaves your device. It works at the HTML level only, leaving inline scripts and styles alone, and it preserves IE conditional comments so legacy targeting still works.

Common use cases

Web performance

Shrink templates and static pages to cut payload size and improve load times.

Build pipelines

Pre-minify HTML partials before deploying to a server or CDN.

Email templates

Reduce HTML email size, which can help with size limits and deliverability.

Embeds & snippets

Compact a widget or ad snippet so it adds as little weight as possible to host pages.

Bandwidth savings

Lower transfer costs on pages served at high volume.

Frequently asked questions

Is my HTML sent to a server?

No. Minification runs entirely in your browser, so your markup never leaves your device.

How much smaller will it get?

Typically 10–30% for standard HTML, and more if your source has heavy commenting or lots of whitespace.

Are IE conditional comments preserved?

Yes. Conditional comments (<!--[if IE]>…<![endif]-->) are kept; all other HTML comments are removed.

Does it break inline JavaScript or CSS?

No. Only HTML-level whitespace and comments are removed; inline scripts and styles are left untouched.

Will minifying change how my page looks?

No. Rendered output is identical — be aware that whitespace between some inline elements is meaningful, so review spacing-sensitive layouts.

Should I keep an unminified copy?

Yes. Edit the readable source and minify as a final step; minified HTML is hard to maintain by hand.

Can I do CSS and JS too?

Use the CSS Minifier for stylesheets. This tool focuses on HTML markup.

Is it free?

Yes — minify as much HTML as you want for free, with no sign-up.

Related tools