HTML Minifier
Strip comments and unnecessary whitespace from HTML. Processed entirely in your browser.
Advertisement space
Minify HTML online for smaller markup
This free HTML minifier removes comments and unnecessary whitespace from HTML text, helping reduce the size of a markup file before it is delivered. Paste HTML or load a local file, then review and copy the result.
Review whitespace-sensitive content
The minifier uses global text transformations rather than a full HTML parser. Content where spaces matter, including preformatted text and embedded CSS or JavaScript, should be checked after minification because the tool does not validate or repair it.
Frequently asked questions
- Yes, completely free with no signup or usage limit.
- No. Everything runs directly in your browser.
- Always review the output before deploying, especially around <pre>, text nodes, attributes, scripts, styles, or any whitespace-sensitive content.
- It removes HTML comments, collapses whitespace around tags, collapses repeated whitespace globally, trims lines, and trims the final result.
- No. It applies text transformations and does not parse HTML, validate semantics, or repair broken markup.
- It can affect whitespace-sensitive content because the minifier uses global whitespace collapsing. Review preformatted text and embedded content before using the result.
- No. The current algorithm does not provide parser-level protection for embedded JavaScript or CSS, so inspect those areas carefully.
- Yes. The client supports pasted HTML and local file input, then provides the minified result in the browser.
Related tools
Or browse the full list of free tools.