HTML Formatter

Paste messy HTML and get neatly indented, readable markup back.

How to use HTML Formatter

  1. Paste your messy HTML into the box.
  2. Click Format to indent it, or Minify to compress it.
  3. Copy the result.

Frequently asked questions

Does Beautify handle self-closing tags correctly?

Only the standard HTML void elements — br, img, input, hr, meta, and similar — are recognized as never needing a closing tag. A self-closing tag outside that list, like an SVG <path /> or a custom component tag, still increases the indent level as if it were left open, which throws off the indentation of everything that follows.

What does Minify actually do?

It strips whitespace between tags and collapses runs of multiple spaces down to one — a basic whitespace squeeze, not a true minifier, so it won't remove comments or touch attribute formatting.

Does this validate my HTML?

No — it only reformats indentation based on where it thinks tags open and close; it doesn't check for unclosed tags, invalid nesting, or other markup errors.

Community

Loading...