Developer tool / 15

HTML Minifier

Parse HTML, remove comments, and conservatively collapse document whitespace in your browser.

HTML Minifier: TOEA uses the browser HTML parser, removes comment nodes, and collapses text whitespace outside preformatted, textarea, script, and style elements. Runs 100% locally in your browser with zero server file uploads.

Runs
In your browser
Cost
Free · no sign-up
Availability
Ready to use
HTML minification pressLocal processing

Runs entirely in your browser

Where whitespace is kept

Each run of spaces, tabs, and line breaks becomes a single space rather than disappearing, because a space beside inline content is visible: in Read <a href="/guide">the guide</a> now both spaces around the link stay. Whitespace is dropped only where a browser would not show it: at the start and end of a block element such as <p>, <li>, or <div>, and between block siblings, like the indentation between <li> items. Text inside <pre>, <textarea>, <script>, and <style> is left exactly as written.

CSS can make a removed space matter again. A <div> styled display: inline-block or a paragraph with white-space: pre-wrap renders whitespace that the HTML alone says is invisible, so compare the rendered page with the original before deploying it.

What the browser parser changes

A fragment, such as a component template, comes back as a fragment; input with a doctype or an <html>, <head>, or <body> tag comes back as a whole document. Either way the markup goes through the browser's parser: unclosed tags are closed, misplaced elements are moved where the parser puts them, and an HTML doctype of any version becomes <!doctype html>. All comments go, including framework markers written as comments.

Inline scripts and styles are left as written. Minify their content separately with the JavaScript minifier and the CSS minifier.

How to use it

  1. Paste HTML.
  2. Choose Minify HTML.
  3. Review and download the compact document.

Privacy & limitations

The document stays local. Always test generated pages because whitespace can be meaningful in inline layouts.

Related tools

Frequently asked questions

Does it remove comments?

Yes. Ordinary HTML comments are removed.

Should I keep my source file?

Yes. Minified output is a deployment artifact, not a comfortable editing format.

Free tool · runs in your browser · no account required