HTML Minifier
Paste HTML to strip comments and collapse whitespace into compact markup. Contents of pre, textarea, script, and style stay untouched, and everything runs in your browser.
pre, textarea, script, and style are preserved exactly. Nothing is uploaded or logged.About the HTML Minifier
The HTML Minifier strips comments and collapses the whitespace between and around tags to produce smaller markup, while leaving the contents of pre, textarea, script, and style blocks exactly as written. It is built for developers and WordPress users who want to trim page weight before shipping templates, email markup, or static files. Everything runs in your browser, so your markup is never uploaded or logged.
How it works
- Paste or type your HTML into the input area.
- Click Minify, or just edit the input, to remove comments and collapse whitespace.
- Read the size summary to see the original bytes, the minified bytes, and the percent saved.
- Click Copy to grab the minified output.
Features
- Removes HTML comments while keeping IE conditional comments intact.
- Collapses runs of whitespace and removes the gaps between tags.
- Preserves the contents of pre, textarea, script, and style blocks byte for byte.
- Shows original size, minified size, and percent saved.
- One-click copy of the output.
Frequently asked questions
Is my markup uploaded anywhere?
No. Minifying happens entirely in your browser. Nothing is sent to a server or logged.
Does it change the contents of script or style tags?
No. The contents of pre, textarea, script, and style are pulled out before whitespace is collapsed and put back unchanged, so code, formatted text, and CSS inside those blocks stay exactly as written.
What does it remove?
It removes HTML comments and collapses runs of whitespace, including the spaces and line breaks between tags. IE conditional comments are kept.
Will collapsing whitespace break my layout?
In most cases no, but whitespace between inline elements can be meaningful in the rendered output. Check pages that rely on spaces between inline tags, and use pre when exact spacing matters.
Does it work offline?
Once the page has loaded, minifying runs locally in your browser, so the tool keeps working without an active connection.