Free tool · HTML compressor
Free HTML minifier
Paste HTML or drop an .html file to remove comments and the whitespace that never shows. See the bytes before and after and the percent saved. The page renders exactly as before.
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><title>Proposal: Website refresh for Acme</title><style>body{font-family:system-ui,sans-serif;margin:0;color:#1c1917}header{padding:32px;background:#1c1917;color:#fff}.tag{display:inline-block;padding:2px 8px;border-radius:999px;background:#fff7ed}main{padding:32px}pre{background:#f5f5f4;padding:12px}</style></head><body><header><h1>Website refresh for Acme</h1><p>Northwind Studio for Acme Ltd <span class="tag">Draft</span> <span class="tag">v2</span></p></header><main><h2>Scope</h2><ul><li>New homepage and <strong>six</strong> landing pages</li><li>Design system in Figma</li></ul><h2>Timeline</h2><pre>Week 1 Discovery
Week 2 Design
Week 3 Build</pre><p style="margin-top:24px;color:#57534e">Questions? <a href="mailto:hello@northwind.example">Email us</a>.</p></main><script>
// Mark the page ready once it has loaded.
document.querySelector('h1').dataset.ready = '1';
</script></body></html>Published free with no signup, the page is live for 7 days; sign up free to keep it. A published page is public to anyone with the link and noindex. Phishing and pages built to collect other people’s passwords or card details are taken down.
How it works
Minify HTML online in three steps
Paste or drop HTML
Paste the code into the editor, or drop an .html file. Hand-written pages, AI exports and email templates all work.
Choose what to remove
Comments, whitespace that never shows, and spare spaces in CSS are on by default. Removing attribute quotes is off until you turn it on.
Copy, download, or publish
See the bytes before and after and the percent saved, then copy the minified HTML, download it as a .min.html file, or publish it as a link.
What it leaves alone
An HTML compressor that does not change the page
Code and scripts stay exact
Text inside <pre>, <textarea> and <script> is copied byte for byte. JavaScript is left exactly as written, because rewriting it safely needs a full JavaScript parser.
Spaces between words stay
A space between two links or bold words is part of the text, and a missing one is too. Whitespace is removed only where the browser ignores it, next to blocks like div, p and li.
CSS keeps its meaning
In <style> and style="" only comments and spare spaces go. Strings, url() values and calc() spacing stay, and no rule is renamed, merged or reordered.
The next step
Compress HTML code, then send it as a link
Noindex by default
Published pages tell search engines to stay away, so a page you share won’t surface on Google the way most free hosts’ public pages can.
Password protection
On Solo and Team, lock confidential pages with an encrypted password we can’t read, enforced before the page ever loads.
View tracking
See when the page is opened. Solo and Team add unique viewers, country and time on page.
More free tools
Other viewers and converters
HTML formatter
Beautify HTML with a 2 or 4 space indent so you can read it again, with the size before and after.
Open the HTML formatter →HTML viewer
Paste or upload a full HTML document and preview it instantly in a sandboxed frame, at desktop or phone width.
Open the HTML viewer →HTML to text
Strip the tags from any HTML and keep the readable text, with lists, tables and line breaks intact.
Convert HTML to text →HTML minifier FAQ
Paste the HTML or drop an .html file into the minifier above. It is minified as you type: comments and the whitespace that does not display are removed, and you see the bytes before and after and the percent saved. Copy the result or download it. It is free, needs no signup, and runs entirely in your browser.
Mostly. An HTML compressor or minifier makes the file smaller by removing what the browser does not need: comments, extra whitespace, spare spaces in CSS. Gzip and Brotli are a second kind of compression your web server applies on top when it sends the file. This tool shows an estimated gzip size too, so you can see both.
Remove only what never renders. This minifier keeps pre, textarea and script contents byte for byte, keeps a space between inline elements wherever one was, and keeps IE conditional comments and Knockout comment bindings. It reads the page’s own style tags and leaves elements alone that they set to preformatted or inline-block. It cannot see rules in external stylesheets or scripts that walk text nodes, so check pages that rely on those.
No. Inline JavaScript is left exactly as written. Shortening JavaScript safely needs a full JavaScript parser, and a careless pass can break template strings or code that relies on line breaks. Inline CSS is minified, but only by removing comments and spare whitespace.
No. Minifying runs in JavaScript in this tab, and nothing you paste or drop is sent to a server or stored. It only leaves your device if you choose to publish it as a page, free and without signup for 7 days, and kept when you sign up.