HTML Minifier

Strip comments and whitespace from HTML — with size savings and a one-click Prettier beautify.

HTML498 B
HTML document · 498 B · runs locally

What this tool does

Paste HTML — a landing page, an email template, a widget snippet — and hit Minify to strip comments and collapse whitespace in place, with the percentage saved shown in the status bar. Beautify goes the other way, re-indenting the document with Prettier when you need to read it. Your markup — tags, attributes, text — is never rewritten, and everything runs in your browser.

How to use it

  1. Paste your HTML into the editor — or hit Upload to open an .html file from your machine.
  2. Click Minify to strip comments and whitespace in place — the status bar shows the size and a chip shows the percentage saved.
  3. Click Beautify to re-indent the document with Prettier — useful for reading minified markup, or for undoing a minify you want to tweak.
  4. Copy the result, or Download it — the file follows the active mode: .min.html after Minify, .html otherwise.

Frequently asked questions

Is my HTML uploaded anywhere?
No. Minifying and beautifying run entirely in your browser. Nothing is sent to a server, logged, or stored.
How much smaller does minified HTML get?
It depends on how much indentation and how many comments the input carries — a typical hand-formatted page shrinks by 10–30%. The status bar shows the document size, and a chip shows the exact percentage saved after each Minify.
What exactly does Minify remove?
Three things: HTML comments (<!-- … -->), the whitespace between tags, and runs of repeated spaces inside text. Tag names, attributes, classes, and your visible text are left untouched.
Is it safe for whitespace-sensitive elements like <pre>?
Mostly, with one caveat: whitespace collapsing applies to the whole document, so runs of spaces and newlines inside <pre>, <textarea>, or inline <script> blocks are collapsed too. If your page relies on literal whitespace there, review the output before shipping it.
What does Beautify do?
It re-indents the document with Prettier — the same engine as our HTML Formatter — turning a minified one-liner back into readable, consistently indented markup. Handy for inspecting minified pages you did not write.