Bytelify

HTML Minify

Strip comments and unnecessary whitespace from HTML, live as you type.

Runs in your browser, nothing sent
html-minify
Minified — 22% smaller
<!doctype html><html><head><title>Page</title></head><body><h1>Hello</h1></body></html>

Strips comments and collapses whitespace live as you type. If your markup relies on preserved whitespace inside a <pre> or <textarea>, check the output — this tool collapses that too rather than special-casing those elements. Runs entirely in your browser.

Need the opposite? HTML Prettifier

What is HTML Minify?

Paste HTML and get it minified instantly: comments and inter-tag whitespace stripped, output shrunk for production without changing the rendered result. Smaller HTML means fewer bytes over the wire on first load, which matters most on a mobile connection or a page with a lot of markup. Minification runs entirely in your browser, so the source never has to be uploaded to a third-party service.

How to Use HTML Minify

  1. 1

    Paste the HTML: Enter any HTML, including comments and indentation.

  2. 2

    Read the Minified Result Instantly: The minified markup appears automatically as you type.

  3. 3

    Copy the Result: Use the copy button to copy the minified HTML for production.

How It Works

HTML comments (`<!-- ... -->`) are stripped, and whitespace between tags (indentation, line breaks, blank lines used purely for readability) is collapsed. Tags, attributes, and text content are left as-is, so the page renders identically; only the formatting whitespace around it is removed.

Example

Before
<div>
  <!-- main heading -->
  <h1>
    Welcome
  </h1>
  <p>Hello world</p>
</div>
After
<div><h1> Welcome </h1><p>Hello world</p></div>

The comment and all inter-tag whitespace are gone; the rendered page is identical.

Common Use Cases

  • Shrinking a static page's markup before deploying it to production, reducing bytes transferred on first load.

  • Compressing an HTML snippet meant to be embedded in an email template or a CMS field with limited size.

FAQs

Frequently Asked Questions

Common questions about HTML Minify.

No, this tool collapses whitespace everywhere, including inside elements where it's meaningful. Check the output if your markup relies on preserved whitespace in those elements.

Yes, regular comments are removed. If you rely on conditional comments or a templating system that repurposes comment syntax, review the output before using it.

Yes, Bytelify's HTML Minify tool is free with no account or sign-up required.

No. Minification runs entirely client-side in your browser, so nothing you paste is sent anywhere.