Quick Answer
An HTML minifier removes everything that a browser does not need — comments, extra whitespace between tags, and unnecessary blank lines — producing a smaller file that renders identically. This tool shows the before and after sizes live so you can see exactly what you save.
What This Tool Does
Paste HTML and the tool strips <!-- comments -->, collapses runs of whitespace between tags, and trims around text content. The output is smaller, loads faster over slow connections, and looks the same in the browser. It is deliberately conservative: attribute values and visible text are preserved exactly.
Key Features
- Live size comparison — input KB, output KB, and percentage saved update as you type.
- Comment removal — developer notes and conditional comments are dropped.
- Whitespace collapsing — the space between
>and<is removed where it is safe. - Safe by design — text content, attribute values, and
<pre>-like spacing are not destroyed.
How to Use the HTML Minifier
- Paste your HTML into the input box (or load the Sample).
- Read the minified result on the right and the size stats above the buttons.
- Click Copy to put the minified HTML on your clipboard.
- Click Download to save it as
index.min.html.
Use Cases
- Shrinking email templates that must stay under a size limit.
- Preparing a single-file HTML demo to share with teammates.
- Reducing payload size for inline HTML in a CMS or a webview.
Tips
- Minified HTML is harder to read — keep the pretty version in source control and minify at build time.
- If a page renders differently after minification, check for
<pre>blocks or inline scripts where whitespace mattered. - For real projects, pair this with a build tool (Vite, Parcel, webpack) so minification happens automatically.
Privacy
Minification is local — your markup never leaves the browser, so templates containing internal URLs or credentials are safe to paste.
Conclusion
Every byte counts on slow networks. Paste, copy the smaller file, and ship it — free and private.