HTML Formatter

Format and beautify HTML or minify it. Indent size, comment stripping, and self-closing tag awareness.

Enter input above to see the result.

What is this for?

HTML markup arrives in your editor in all sorts of states — minified for production, generated by templating engines with no regard for whitespace, hand-typed and indented inconsistently. This tool reformats any HTML fragment with consistent indentation per nested element, recognising void elements (<img>, <br>, <meta>) and inline elements (<a>, <span>, <strong>) so the output looks like real HTML, not a layout-by-rule. Minify mode strips inter-tag whitespace and optionally comments. Everything stays in your browser.

When to use it

Common gotchas