BYTETOOLS

HTML Minifier

Minify HTML online: strip comments, collapse whitespace between tags and shrink page size. See bytes saved instantly. Free, private, runs in your browser.

What is the HTML Minifier?

The ByteTools HTML Minifier compresses your markup by removing HTML comments, collapsing runs of whitespace and deleting the gaps between tags.

  • Strips HTML comments (keeps IE conditional comments)
  • Collapses whitespace and removes inter-tag gaps
  • Preserves pre, script, style and textarea content exactly
  • Shows bytes before, after and percent saved
  • Copy or download the minified file
  • 100% client-side — markup never leaves your browser

How to use the HTML Minifier

  1. 1

    Paste your HTML into the input box.

  2. 2

    Click Minify HTML.

  3. 3

    Check the before/after size stats and the percentage saved.

  4. 4

    Copy the minified markup or download it as an .html file.

About the HTML Minifier

The ByteTools HTML Minifier compresses your markup by removing HTML comments, collapsing runs of whitespace and deleting the gaps between tags. The result is a smaller document that downloads and parses faster — the before/after size and percentage saved are shown the moment you minify.

It is careful where it matters: content inside <pre>, <script>, <style> and <textarea> is left completely untouched, and Internet Explorer conditional comments are preserved because some email templates and legacy pages still rely on them. Regular comments, indentation and blank lines are stripped.

Minification runs 100% locally in your browser. Your HTML is never uploaded to a server, so you can safely compress unreleased landing pages, email templates and client projects.

Frequently asked questions

How much smaller does minified HTML get?

Typical hand-written pages shrink by 5–25% depending on how much indentation and comments they contain. Template-generated HTML with deep indentation often saves more; already-compact markup saves less. The tool shows your exact numbers after minifying.

Does minifying HTML break the page?

Rarely. Browsers collapse whitespace between block elements anyway, so removing it changes nothing visually. Spacing between inline elements can matter in edge cases, and the tool intentionally leaves whitespace-sensitive regions like <pre> and <textarea> untouched.

Why keep conditional comments when minifying?

Conditional comments like <!--[if IE]> are not decorative — legacy pages and many HTML email templates use them to serve fallback markup to old rendering engines. Stripping them would silently break those fallbacks, so the minifier preserves them.

Should I minify HTML if I already use gzip or Brotli?

Yes, they stack. Compression handles repetition well, but minification removes bytes before compression even starts, and the browser still has to parse whatever arrives. Minified + compressed is consistently smaller and faster than compressed alone.

Is my HTML uploaded when I minify it?

No. The minifier is pure client-side JavaScript — your markup is processed in the browser tab and never transmitted, logged or stored anywhere.

Guides for HTML Minifier

Related tools