HTML Minifier
Shrink HTML by removing comments and unnecessary whitespace. Inline CSS and JavaScript are minified too.
edit_noteInput
outputOutput
Minify HTML to cut page weight, or beautify it to read it clearly. The minifier is whitespace-aware rather than regex-based, so it understands where whitespace actually matters and never breaks your markup.
Frequently asked questions
Yes, when it is done with a parser rather than regular expressions. This tool tracks tags, attributes, comments and text separately, so it knows the space between two inline elements is a real word break while the indentation between block elements is not. Content inside pre and textarea is left exactly as written.
Yes - inline style and script blocks are minified too, using the same safe tokenisers as the CSS and JS tools. JSON-LD and templating blocks are detected by their type attribute and deliberately left untouched.
Ordinary comments are, but conditional comments are kept. Those are markup rather than notes, and stripping them would break the legacy browser fallbacks some pages still ship.
Typically 20-40% on hand-written, well-indented HTML. Pages that are already generated by a build tool see less benefit. The exact saving is shown under the output.