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.
- 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.
- <div> <p>Hi</p> <ul> <li>a</li> <li>b</li> </ul> </div>
- <div><p>Hi</p><ul><li>a</li><li>b</li></ul></div>
- <div> <pre> two spaces kept</pre> </div>
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.
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.