HTML Minifier
Paste HTML and get a compact version with comments stripped and whitespace collapsed. The size saving is shown immediately.
Minified
Paste code to minify it.
About this tool
Whitespace between tags and developer comments make up a surprising share of a page's bytes. Minifying removes them so the HTML downloads and parses faster. Conditional comments for old Internet Explorer are kept, and content inside pre, textarea, script and style elements is left exactly as written because whitespace matters there.
This minifier is deliberately conservative: it does not remove optional closing tags or attribute quotes, so the output is safe for any parser and validator. Combine it with the CSS and JavaScript minifiers for embedded code.
Frequently asked questions
- Will minification change how my page looks?
- Collapsing runs of whitespace to a single space is what browsers do anyway. The only visible risk is inline elements separated by a newline, which become separated by one space — the same rendering.
- Are the CSS and JS inside the page minified?
- No, their content is preserved untouched. Minify them separately with the dedicated tools.
- How much does it save?
- Typically 10–25% on hand-written pages, more on templates with deep indentation.