Skip to main content

HTML Minifier — Compress HTML, Strip Comments & Whitespace

Minify HTML — strip comments, whitespace, optional attributes, inline CSS/JS. 40-60% smaller.

  • Runs locally
  • Category Format Converter
  • Best for Turning pasted content or local files into a handoff-friendly format.
Options:
Input
Output
Minified output appears here.

What this tool does

Free online HTML minifier and compressor. Paste a raw HTML document (full page, fragment, email template, AMP page, server-rendered output) and get a production-tight single-line version typically 40-60% smaller than the input. Every transform is an opt-out checkbox: strip comments (but keep conditional <!--[if IE]--> and SSI <!--#include-->), collapse all whitespace between tags, collapse runs of whitespace inside text nodes to a single space, remove redundant attribute quotes when the value contains no spaces / quotes / equals / angle-brackets (id="x" → id=x, safe per HTML5 spec), normalize boolean attributes (disabled="disabled" → disabled, same for checked / selected / readonly / required / autofocus / hidden), and drop optional closing tags (</li> </tr> </td> </th> </p> when the next sibling makes the close inferable per the HTML5 parser rules). The tokenizer is HTML5-aware: it respects raw-text elements (script, style, textarea, pre — text inside is never collapsed), CDATA, entity references, and self-closing void elements (img, br, hr, input, meta, link). Live size diff (original / minified / saved %) under the output. 100% client-side — your unreleased landing pages, email blasts, and internal templates never leave the tab. Pair with our CSS Minifier and JS Minifier for a complete pre-deploy squeeze; pair with HTML Entities Encoder when you need to inline HTML in a JSON or XML payload.

Tool details

Input
Files + Text + Structured content
The page exposes text boxes, numeric controls, file pickers, or structured inputs depending on the tool.
Output
Live result + Copy + Download
The result area focuses on usable output, with copy, download, or preview actions when supported.
Privacy
Browser-side processing
The main tool logic does not call an external API, so inputs normally stay in the current tab.
Save / share
No account required
Open the page and use it; whether results survive refresh depends on the tool.
Performance budget
Initial JS <= 14 KB
No WASM budget is declared, keeping the tool quick to open on mobile.
Best fit
Format Converter · Developer
Category and role tags drive related tools, internal links, and quick fit checks.

How to use

  1. 1. Input

    Paste or drop your content into the tool panel.

  2. 2. Process

    Click the button. All processing is local in your browser.

  3. 3. Copy / Download

    Copy the result or download to disk in one click.

How HTML Minifier fits into your work

Use it when the main problem is getting content from one practical format into another.

Conversion jobs

  • Turning pasted content or local files into a handoff-friendly format.
  • Previewing a conversion before you use it in a larger workflow.
  • Cleaning small format mismatches without opening a full editor.

Conversion checks

  • Try a small sample first when the source format is messy.
  • Check character encoding, separators, and line endings after conversion.
  • Keep the source until the converted output has been reviewed.

Good next steps

These links move the current task into a more complete workflow.

  1. 1 JS Minifier Minify JavaScript — strip comments, whitespace, optional name shortening. 40-70% smaller. Open
  2. 2 CSS Minifier Minify CSS — strip comments, whitespace, shorten colors, merge selectors. 30-60% smaller. Open
  3. 3 CSS Formatter & Minifier Format and beautify CSS — sort properties, indent rules, expand or minify. Open

FAQ

Tool combos

Folks in your role tend to reach for these alongside this tool.

Made by Toolora · 100% client-side · Updated 2026-05-29