HTML Minifier
Minify HTML online for free — remove comments and collapse whitespace while protecting script, style, pre and textarea content. Runs entirely in your browser.
100% private — runs entirely in your browser. Your files never leave your device.
Removes comments and collapses formatting whitespace between tags, while protecting the contents of
<pre>, <textarea>, <script> and <style>.
IE conditional comments are kept. Runs entirely in your browser.
How to use the HTML Minifier
- Paste your HTML.
- It's minified, protecting script, style and pre blocks.
- Check how much size you saved.
- Copy or download the result.
What you can use it for
- Reduce HTML page weight
- Strip comments and formatting whitespace
- Prep templates for production
- Keep inline scripts and styles intact
More free tools
Wrangling code or data?
Format, encode, hash and minify with our free developer tools — 100% in your browser.
Browse all free developer tools →Frequently asked questions
Will it break my inline scripts or styles?
No — the contents of <script>, <style>, <pre> and <textarea> are protected and left untouched.
Does it keep IE conditional comments?
Yes — normal comments are removed, but conditional comments (<!–[if …]–>) are preserved.
Why did some spacing change between inline elements?
Formatting whitespace between tags is collapsed to reduce size. Intentional single spaces in text are kept.
Is my HTML uploaded?
No — everything runs in your browser.