Esta página ainda não foi traduzida para o português, por isso aparece em inglês.

HTML Minifier — Minify HTML Online

Shrink HTML pages and templates by removing comments and redundant whitespace, minifying inline <style> and <script>, and cleaning up attributes — while keeping the layout identical.

Atualizado em
Open file

Seus dados nunca saem do seu computador. Todo o processamento acontece localmente no navegador.

Como usar: HTML Minifier

  1. Paste HTML or open an .html file.
  2. Choose what to remove: whitespace, comments, default type attributes and redundant boolean values.
  3. Keep inline CSS and JavaScript minification on to shrink <style> and <script> blocks too.
  4. Copy or download the minified HTML and compare the sizes above.

What does HTML minification remove?

Hand-written and generated HTML contains indentation, line breaks and comments that browsers ignore. Removing them reduces the bytes the browser has to download before it can start rendering. Typical savings are 10–25 % of the raw HTML, more for templates with deep indentation or long comments.

BeforeAfter
<!-- nav -->(removed)
<button disabled="disabled"><button disabled>
<script type="text/javascript"><script>
class=" card featured "class="card featured"
Indentation between <li> items(removed)

Safe whitespace handling

Whitespace in HTML is not always meaningless: the space in <strong>Free</strong> plan separates two words. This minifier keeps a single space between inline elements and text, removes whitespace only around block-level elements such as div, p, li and section, and never touches the content of <pre> and <textarea>, where spacing is part of the content.

What is kept

  • Conditional comments (<!--[if IE]>) and comments starting with <!--!.
  • Attribute quotes — removing them saves little and can break attribute values with spaces.
  • Scripts with non-JavaScript types such as templates; JSON-LD is minified as JSON.

Minify HTML in production

For a build pipeline, use your framework’s built-in minifier or html-minifier-terser. For one-off pages, email templates, CMS embeds and Webflow custom code, this tool is quicker. After minifying, make sure your server compresses the HTML too — check it with the website compression test. To make minified HTML readable again, use the HTML formatter.

Também pesquisado como: minify html, html compressor, compress html, html minify online, remove whitespace html, minify inline css js.

Ferramentas que combinam com: HTML Minifier

  • JavaScript Minifier — Paste JavaScript and get production-ready minified code from Terser — the same engine used by Vite, webpack and Rollup — with real before/after and gzipped sizes.
  • CSS Minifier — Paste a stylesheet to shrink it instantly.
  • SVG Optimizer — Clean up SVGs exported from Figma, Illustrator, Inkscape or Sketch with SVGO — and check the before/after preview to make sure the icon still looks right.
  • Gzip Compress & Decompress — Compress text or any file with gzip, zlib or raw deflate — or paste Base64 / open a .gz file to decompress it.

Perguntas frequentes

Does minifying HTML improve SEO?
Smaller HTML loads faster, which helps Core Web Vitals and user experience. Search engines read minified HTML exactly like formatted HTML, so content and rankings are not affected otherwise.
Can minification break my layout?
Rarely. This tool keeps the spaces that matter between inline elements. If something changes, turn off Collapse whitespace and minify only comments and inline code.
Does it minify CSS and JavaScript inside the HTML?
Yes. <style> blocks and style attributes are minified, and <script> blocks are minified with Terser. If a script has a syntax error, it is left unchanged.
Is my HTML uploaded?
No. Minification happens in your browser.
Posso instalar o HTML Minifier como um aplicativo da web e usá-lo offline?
Sim. O HTML Minifier é um aplicativo da web instalável (PWA) — instalado a partir do seu navegador, não baixado de uma loja de aplicativos. Clique em “Instalar aplicativo” na parte superior desta página no Chrome ou no Edge (Windows, macOS, Linux, ChromeOS) ou, no Android, use “Compartilhar” → “Adicionar à tela inicial” no iPhone e no iPad, ou “Arquivo” → “Adicionar ao Dock” no Safari 17+ em um Mac. Em seguida, ela se abre em uma janela própria com seu próprio ícone e, como é executada inteiramente no seu navegador, continua funcionando offline. O Firefox no desktop não permite a instalação de aplicativos da web. Como funciona a instalação.

Ferramentas relacionadas