◐ Web & Design

HTML Minifier

Collapse HTML markup, remove comments, and preview smaller output instantly.

Updated

Preserve comments option Whitespace collapse Size stats

Loading HTML Minifier…

What this page sends

  • Your input: Processed in this tab and not sent to a server.
  • Share links: Share links put a Base64 copy of your input and output in the URL itself (after #d=). Anyone with the link can read it, so don't share a link that contains secrets.
  • Editor: On desktop screens the code editor (Monaco) is downloaded from cdn.jsdelivr.net; phones get a built-in lightweight editor instead.
  • Page load: Loading the page requests HTML, scripts and images from ByteKiln, fonts from Google Fonts, and sends Google Analytics page views, tool-usage events and catalog interactions (tool/category IDs, result status and whether a click followed search — never your input, output or search terms). Privacy & sharing

How the HTML Minifier Works

The ByteKiln HTML Minifier collapses whitespace between tags and optionally strips HTML comments, reducing markup size instantly in your browser. A size comparison shows you the before/after byte savings.

What gets removed

Redundant whitespace between HTML tags is collapsed or removed entirely. Comments are stripped unless the Preserve Comments toggle is enabled. Tag names, attributes, and values are never modified.

Whitespace-sensitive markup

Inline elements like <span>, <a>, and <strong> can be affected by whitespace removal. Always preview minified output in a browser before deploying to catch any rendering differences in your markup.

Preserve comments toggle

Enabling this option keeps all HTML comments in the output — useful for conditional IE comments, build pipeline markers, or copyright notices that must remain in the delivered markup.

Limitations

  • It collapses whitespace and removes comments; it doesn't minify inline <script> or <style> contents, remove attribute quotes, or drop redundant attributes, so a build-time tool like html-minifier-terser goes further.
  • Whitespace between two inline elements is kept as one space; next to block-level elements it is removed. Elements styled with display: inline-block or white-space: pre via CSS are not detected.
  • Aggressive mode removes optional closing tags per the HTML spec, which is valid HTML but can confuse XML-based tooling and some template engines.
  • The markup isn't validated: unclosed or misnested tags pass through as they are.

FAQ

Short answers for the things developers usually ask before trusting a tool.

What does HTML minification remove?

The ByteKiln HTML Minifier collapses redundant whitespace between tags, removes comments, and trims unnecessary characters. It does not change tag names, attribute values, or the visible structure of your page.

Will minification break whitespace-sensitive HTML?

Some HTML is whitespace-sensitive — for example, inline elements like <span> or <pre> blocks where spaces affect rendering. The minifier handles common cases well, but you should always preview the output before deploying.

Can I preserve HTML comments?

Yes. Enable the "Preserve comments" toggle to keep comments in the output. This is useful for conditional IE comments or copyright notices that must remain in the markup.

Is my HTML code uploaded to a server?

No. The markup is minified in your browser and is not sent to a ByteKiln server. If you press Share, the link itself carries a readable copy of your input, so don't share links that contain secrets.

Is this tool appropriate for production HTML builds?

For manual inspection, quick checks, and learning, yes. For automated builds, prefer dedicated tools like html-minifier-terser or your framework's built-in HTML compression, which handle more edge cases.

Related tools

Useful follow-ups when one conversion usually turns into three more.

Want the background and worked examples? There's a longer write-up.

Read the HTML Minifier guide

Related guides