⚡
usefultools.dev
</>

HTML Minifier

NOVO

Minify HTML in your browser: remove comments and extra whitespace, keep pre, textarea and script content intact, and see the bytes saved.

Funciona 100% no seu navegador — o que você insere nunca é enviado nem armazenado nos nossos servidores.

Esta ferramenta ainda não está totalmente traduzida, por isso parte do texto continua em inglês. A ferramenta funciona da mesma forma em todos os idiomas.

Opções

What is kept exactly: the content of <pre>, <textarea>, <script> and <title>, attribute quotes and values (only whitespace around a few attributes such as class is trimmed), and the single space between inline elements such as links and spans.

Whitespace modes: safe mode removes spaces next to block elements such as div, p and li. If your CSS turns those into inline-blocks, use conservative mode. Aggressive mode also removes the space between inline elements and text, which can join words. The HTML is parsed as text, never executed.

⚡

Exemplos rápidos

Entradas típicas e os resultados que esta ferramenta gera.

Whitespace
<p> Hello <b>world</b> </p>
<p>Hello <b>world</b></p>
Inline gap
<a href="/a">One</a> <a href="/b">Two</a>
<a href="/a">One</a> <a href="/b">Two</a>
Comment
<!-- note --> <div class=" a b ">x</div>
<div class="a b">x</div>
Keeps pre
<pre> a b </pre> <p> x </p>
<pre> a b </pre><p>x</p>
📖

Visão geral

The HTML minifier shrinks a page by removing what browsers do not need: comments, indentation, line breaks and repeated spaces. Smaller HTML means fewer bytes to download, which helps page speed.

It reads the markup with a tokenizer rather than a pattern replace, so the content of pre, textarea, script and title stays exactly as written and attribute quotes are never removed. A single space between inline elements such as links and spans is kept, so buttons and menus do not collapse into each other.

Options let you keep conditional and Knockout comments, minify inline CSS, trim class attributes and choose safe, conservative or aggressive whitespace. The result shows the size before and after, and everything runs in your browser.

Por que usar esta ferramenta?

  • Cut page size before deploying static HTML
  • Inline spaces and pre content stay intact
  • See bytes and percent saved immediately
  • Nothing is uploaded, code stays in your browser
  • Free, no sign-up
⭐

Recursos

🧹

Whitespace collapse

Removes indentation and line breaks and keeps one space where text needs it.

💬

Comment control

Removes comments but can keep IE conditional comments and Knockout <!-- ko --> comments.

🛡️

Protected content

The content of pre, textarea, script and title is copied exactly as written.

🎨

Inline CSS

Minifies style elements and style attributes by removing comments and extra spaces.

⚙️

Three whitespace modes

Safe, conservative (keep one space) or aggressive (drop it between all tags).

📊

Size report

Shows original and minified bytes, bytes saved and the percentage, then copy or download the file.

🛠️

Como usar

1

Add your HTML

Paste the markup, use Upload file, or press Load sample.

2

Choose a whitespace mode

Keep Safe for most pages, or use Conservative if your CSS changes how block elements display.

3

Check the options

Decide which comments to keep, whether to minify inline CSS and whether to trim attribute whitespace.

4

Copy or download

Read the size report, then press Copy or Download .html.

🤔

Perguntas frequentes