HTML minifier
Shrink HTML by stripping comments, extra whitespace and empty attributes.
HTML minifier
Paste any HTML document or fragment and this tool returns a smaller version with the same rendered result. It strips comments, collapses redundant whitespace between tags and inside attribute lists, and removes empty attributes such as class="" that a browser ignores anyway. Use it before shipping a static page, embedding a template into another system, or pasting markup somewhere with a size limit.
Four options control how far the minification goes. "Preserve pre, textarea and script content" keeps the exact whitespace inside those elements untouched by default, since a stray space inside a <pre> block or a script is often meaningful; turn it off only if you know that content can tolerate whitespace collapsing. "Merge multiple spaces in text" turns runs of spaces, tabs and line breaks inside ordinary text into a single space. "Remove quotes from simple attribute values" drops the quotes around values like id=box that don't need them under the HTML5 spec — anything with a space, an equals sign or another quote stays quoted. "Remove optional closing tags" drops closing tags a browser infers on its own, like the </li> before another <li> or the </td> before </tr>, using the same rules browsers use to auto-close them.
The tool works on the raw text of your markup rather than re-serializing a full DOM, so it never rewrites tag or attribute name casing — inline SVG with case-sensitive elements like viewBox or clipPath comes through unchanged. It handles both Windows and Unix line endings, and the tally under the output reports the byte size before and after minification along with the percentage saved.
Everything runs locally in your browser — your markup is never uploaded anywhere, which makes this safe for internal templates or anything not yet public. Copy the result, download it as a .txt file, or send the output back into the input to layer another pass.