Developer Tools

HTML minifier online.

Remove safe-to-drop HTML comments and redundant tag whitespace without flattening page content.

This free HTML minifier runs entirely in your browser. It preserves text-node spacing, conditional comments, and whitespace-sensitive blocks such as <pre>, <textarea>, <script> and <style>. Nothing you paste is uploaded.

How to minify HTML

  1. Paste up to 1 MB of HTML into the box.
  2. Press Minify HTML.
  3. Copy the smaller markup and compare the sizes shown.

What it changes and what it leaves alone

The minifier removes ordinary comments and compacts whitespace inside tags, around attributes and equals signs. It deliberately keeps whitespace between and inside text, because removing it can join words, change inline layout or alter content that CSS formats with white-space rules. Raw-text content such as script and style, escapable raw-text such as textarea, pre blocks, templates and conditional comments is copied exactly.

That makes it conservative by design: the output should look and behave the same as the input. Savings are usually modest, a few percent on hand-written pages, more on markup full of comments. For the best results on a real site, combine it with server compression such as Brotli or gzip, which does far more than whitespace removal.

Minified on your device

The minifier runs in your browser, inside an isolated frame on this page that has no network access. Your file is read and written back by your own device, so it is not uploaded to TNAADO or anyone else, and nothing is stored. The advertising on this page sits outside the frame and cannot see what you choose. Your markup, including any inline data in it, is not uploaded.

What this minifier changes

The minifier removes ordinary comments and compacts whitespace around attributes and equals signs inside tags. It deliberately keeps text-node and inter-tag whitespace, because removing it can join words, alter inline layout, or change content under a CSS white-space rule.

Content in the HTML Standard's raw-text and escapable raw-text elements is copied exactly. The same conservative treatment covers <pre> content, templates, and legacy raw-text elements.

Limit: this is a conservative production pass, not an HTML validator or a template compiler. It does not remove optional tags, rewrite attributes, or minify CSS and JavaScript embedded in the document.

HTML minifier FAQ

How does this HTML minifier avoid breaking page content?

It removes ordinary HTML comments and normalizes redundant whitespace inside tag syntax. It does not collapse text nodes or spacing between tags, where whitespace can affect rendered text and inline layouts.

Does it preserve pre, textarea, script and style content?

Yes. Content inside preformatted, raw-text and related whitespace-sensitive elements is copied exactly, including pre, textarea, script, style, title, template and legacy raw-text elements.

Is my HTML uploaded?

No. Minification, copying and file creation happen locally in your browser. The HTML you paste is not sent to a server by this tool.

What does this HTML minifier not do?

It does not validate or repair malformed HTML, remove optional tags or attributes, minify embedded CSS or JavaScript, or guarantee template-language directives. Compile server-side and framework templates before using it.

Advertisement
Advertisement