🧰Tools 🗜️ Compression🔄 Conversion✏️ Editing📄 PDF Tools⚡ Optimization🌐 Web Tools🧰 All Tools (69)
📱 Android App 📝 Blog 👋 About

Web Tools · Free · No signup

Minify HTML — Smaller Pages, Same Markup

Paste any HTML document and get a lighter version in one click: comments go away and whitespace between tags collapses, while your <pre>, <textarea>, <script> and <style> blocks are protected exactly as they are. Byte-accurate savings are shown after every run — and the whole job happens locally in your browser.

🔒 100% private: everything runs inside your browser — nothing is uploaded, stored or logged.

How it works

  1. Paste your HTML into the input box — the page, an email template, a component, anything.
  2. Keep or uncheck the two options: comment removal and whitespace collapsing.
  3. Hit Minify — the result appears instantly with original size, minified size and savings.
  4. Copy the result to your clipboard or download it as a .html file.

Features

Protected blocks, always

<pre>, <textarea>, <script> and <style> are lifted out before minification and put back byte-for-byte — indentation inside them survives.

Conditional comments kept

Downlevel-revealed and <!--[if …]<![endif]--> conditional comments are never touched — legacy Outlook and IE hooks keep working.

Byte-accurate report

Savings are measured in real bytes (UTF-8), not characters — you see exactly what the server will save.

One-click handoff

Copy the minified markup or download it as a file, ready to drop into your build output.

100% private

The minifier is plain JavaScript running in your browser. Nothing is uploaded, stored or logged.

Input & output. Any HTML fragment or full document works — templates, email HTML, inline SVG containers, static site output. Output is a single line of collapsed markup ready for production; run it through your own formatter if you need to read it again later.

Common use cases

Limitations (honest ones)

This is a text-level minifier, not an HTML parser: it never removes attributes, rewrites tags or reorders elements, and it does not validate markup. Collapsing whitespace merges runs of spaces in visible text down to one space — deliberate double-spacing in copy disappears. Whitespace inside pre, textarea, script and style blocks is left completely untouched.

Frequently asked questions

Is it safe for my <pre> and <textarea> blocks?

Yes. Those blocks are extracted before minification and restored byte-for-byte afterwards, so code samples and form values keep their exact spacing.

Will it break inline JavaScript or CSS?

No. Script and style elements are protected from the whitespace collapsing. Note that this tool does not minify their contents — run the CSS Minifier or JS Minifier for that.

Does it remove conditional comments?

No. <!--[if …]<![endif]--> conditional comments are intentionally preserved; every other comment is removed.

How much smaller will my HTML get?

Typical hand-written or CMS output shrinks by 5–20%, mostly from indentation and comments. Already-minified HTML may barely change.

Is my HTML uploaded to a server?

No. Everything runs locally in your browser — you could disconnect from the internet and the tool would still work.

Keep going

Related tools

CompressoPanda Android app icon

On mobile?

Working from your phone?

This tool runs in any mobile browser — no app needed. And for the image & PDF side of the toolbox, the CompressoPanda Android app ships 36 tools that run with no connection at all: compression to target size, editing and PDF essentials included.