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.

No nesting problems were reported for this markup. 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, listing, textarea, script, style and title nothing is touched at all. An HTML plaintext opening keeps all remaining source exactly as written, including apparent closing tags. Template and datalist content and ordinary hidden-attribute subtrees also stay as written, with outer inline separators preserved. A dialog without an open attribute is hidden; open="false" still opens it. HTML boundaries assume scripting is enabled: noscript bodies stay literal, including apparent tags, without running scripts. Foreign SVG and MathML noscript elements use markup boundaries. 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. Indentation output is limited to 8,000,000 characters; larger results are refused with the input left intact. 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. Template content and ordinary hidden-attribute subtrees stay as written; their outer inline separators are preserved. Legacy HTML listing content is preserved too. After an HTML plaintext opening, all remaining source stays literal through the end, including apparent closing tags. Closed HTML dialog content also stays literal, with existing exterior inline spacing preserved; the boolean open attribute makes it visible even when its value is "false". HTML boundaries assume scripting is enabled, without running scripts: noscript bodies stay literal, while foreign SVG and MathML noscript uses markup boundaries outside HTML integration points.
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.
What are the input and output limits?
The input limit is 2,000,000 characters. Format also checks an 8,000,000-character output budget before adding indentation. Refused results leave your original input intact. Minify avoids indentation growth while preserving protected content and original tags.

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