← All tools/Minifiers/Code/HTML Minifier
HTML Minifier
Smaller HTML, in your browser — paste HTML in, minified HTML out, with bytes saved.
Paste HTML here. It is minified as you type, in your browser.
Size saved
How it works
Minified = comments removed, whitespace collapsed, spaces between > and < removed, spaces at the start and end of text removed
Worked example: the sample minifies to <div class="card"><h2>Hello</h2><p>Welcome to WhiteUI.</p></div> — the comment is gone, the line breaks between tags are gone, and the spaces around “Hello” are gone, because they add nothing inside a heading.
Frequently asked questions
Is my HTML sent anywhere?
No. Everything runs in your browser. Nothing is uploaded, stored or logged.
Will minifying break my layout?
Not for ordinary HTML. Only comments and whitespace that browsers ignore are removed; the words on the page keep their single spaces, so sentences read exactly as before.
What about spaces inside or
Be careful there: this minifier collapses whitespace everywhere, including inside
blocks where spaces matter. Do not use it on pages where preformatted text must stay exact.Are attributes changed?
No. Attribute names, values and quotes are copied exactly as written; only the whitespace around tags is touched.
More tools
Tell us what you think
Loving this tool, or stuck on something? Tell us — it takes a minute.
We’ll only use your name and email to reply if needed. The tool and page are filled in for you.