webutilkit

HTML Formatter

Reformat minified or messy HTML with consistent indentation, in your browser.

Formatted

How it works

Your markup is parsed with the browser’s own HTML parser — the same one that renders every web page — then walked and re-printed with two-space indentation per level of nesting. Void elements like <img> and <br> are printed without a closing tag, matching how HTML defines them.

Why formatting can change the structure

Because a real HTML parser is doing the reading, markup with unclosed tags or elements in invalid positions gets corrected the same way a browser would fix it before rendering — so the formatted output reflects the structure a browser actually sees, which can differ from what was typed.

Common uses

Making minified HTML from a build tool readable again, or cleaning up markup copied from a source that stripped all the whitespace.

Frequently asked questions

Does this fix broken HTML?

It uses the browser’s own HTML parser, which is designed to recover from unclosed tags and other errors the same way a real browser would when rendering the page — the output reflects that repaired structure, not a strict validation of your original markup.

What happens to a full HTML document versus a snippet?

Pasting a snippet formats just that markup. Pasting a full document (starting with <!DOCTYPE html> or containing an <html> tag) formats the entire document, doctype included.