gizmobench
BrowseDaily

HTML Minifier

Paste HTML source and copy or download compact output. This page opens in Minify mode and keeps your remembered indentation and draft. Tags, attributes, entities and comments remain, and pre, textarea, script, style and title contents are kept. Only eligible whitespace is reduced; embedded CSS and JavaScript are not compressed.

minifiedminified
<div><p>Hi</p><ul><li>a</li><li>b</li></ul></div>
Mode
Indent
Lines
1
Saved
none

1 line out, 49 characters, nothing to report.

Every element in this markup opens and closes where it says it does, so there is nothing to report. to see what the notes look like.

  • One-line HTMLformat
    <div> <p>Hi</p> <ul> <li>a</li> <li>b</li> </ul> </div>
  • Minifyindented input
    <div><p>Hi</p><ul><li>a</li><li>b</li></ul></div>
  • <pre> contentformat
    <div> <pre> two spaces kept</pre> </div>
What moves, and what does not. Only whitespace moves, and only where a browser in normal flow does not render it: between block level tags, where a line break costs nothing, and inside a line of text, where a run of spaces already renders as one. Two inline tags written with nothing between them are never split across lines, because that would add a space the page would show. Inside pre, textarea, script, style and title nothing is touched at all. What no formatter can see is your CSS: a div set to white-space: pre is whitespace sensitive in a way the markup alone does not say.

Up to 2,000,000 characters in one pass, read here in your browser with nothing uploaded and no account. Minify takes out the whitespace and nothing else: comments, attributes and entity references all survive it. The mode, the indent and the draft are kept in this browser alone, drafts up to 200,000 characters, and the Start over button above the tool forgets them.

Accuracy. Keeps original tags and the contents of pre, textarea, script, style and title; formatting rewrites whitespace elsewhere. CSS can make that whitespace significant.

Common questions

What is removed from the HTML?
Eligible whitespace between ordinary block elements and redundant ordinary text spacing. Comments, tags, attribute spelling/order/quoting, entities and protected element contents remain. Output can still contain line breaks inside protected content.
Does it remove comments or minify CSS and JavaScript?
No. This is an HTML whitespace minifier. It has no comment-removal setting and does not rewrite script or style bodies, templates, class names or attribute values. It does not apply gzip or Brotli.
Is the minified output guaranteed to render identically?
No. The tool does not read your stylesheets, and CSS white-space or display rules can make changed whitespace meaningful. Review the result in its real page context. Original tags are preserved, but that is not a guarantee of identical HTML/CSS layout.
How do I save a minified HTML file?
Paste source from your editor, then use Download for the output or Copy to paste it into a file. The original input remains in the editor. There is no file upload or URL fetch in this tool.
Can I format the compact HTML again?
Switch Mode to Format or use the HTML Formatter. Formatting can improve source layout, but cannot restore information that another minifier removed.

Keeps original tags and the contents of pre, textarea, script, style and title; formatting rewrites whitespace elsewhere. CSS can make that whitespace significant.