MockFoxAdvertise

HTML Minifier

Updated Free mock REST & WebSocket APIs

Paste HTML to shrink it: comments and insignificant whitespace are removed, attribute quotes and boolean values are shortened, and inline CSS is minified — without touching the content of <pre>, <textarea> or your scripts.

Paste, type, or drop a file onto the box.
Minified HTML

796 → 693 bytes (13% smaller before gzip).

🔒 Runs in your browser — nothing you paste is uploaded.

How to minify HTML

  1. Paste HTML or drop an .html file onto the input.
  2. Choose what to remove: comments, attribute quotes, inline CSS whitespace.
  3. Check the size saving, then copy or download the minified file.

What gets removed

BeforeAfter
<!-- nav -->(removed; IE conditional and <!--! --> license comments kept)
Indentation and line breaks between blocksRemoved
Hello   world in textHello world
class="card"class=card
disabled="disabled"disabled
.a { color : red ; }.a{color:red}

Is minifying HTML worth it?

With gzip or Brotli, which every modern host enables, minification typically saves an extra 5–15% of HTML transfer size — useful for large server-rendered pages, email templates (where size limits apply, like Gmail clipping messages over 102 KB) and HTML embedded in JavaScript. Always keep the readable source and minify as a build step.

Related tools

Frequently asked questions

Is my HTML uploaded anywhere?

No. The conversion runs entirely in your browser with JavaScript, so your HTML never leaves your device and isn't logged or stored.

Is the minified HTML still valid?

Yes. Unquoted attribute values and bare boolean attributes are valid HTML5, and only whitespace that doesn't affect rendering is removed.

Does it minify JavaScript?

Inline scripts are trimmed but not rewritten (JSON and JSON-LD scripts are compacted). Use a JavaScript minifier such as Terser or esbuild for scripts.

Why is there still a space between some tags?

A space between inline elements (like two links) is visible on the page, so it's kept to avoid changing your layout.

Your business here? Sponsor this tool from $16/week. See placements