HTML Formatter & Beautifier

Paste in messy, minified, or inconsistently-indented HTML to clean it up, or minify it down — runs entirely in your browser, nothing is uploaded anywhere.

Your HTML

Frequently asked questions

Is there an official HTML formatting standard?

No — unlike JSON, there's no spec dictating HTML indentation or line breaks. This tool follows the conventions most widely used in practice (and matched by tools like Prettier): 2-space nested indentation by default, lowercase tags and attributes, and quoted attribute values. It also leaves the content of <script>, <style>, <pre>, and <textarea> untouched, since reformatting those could change what actually renders or runs.

Will this fix broken or mismatched tags?

This tool parses HTML the same way a browser does, so it will auto-correct the kind of things browsers silently fix — like an unclosed <p> tag before a new block element starts. It's a good way to see how a browser actually interprets messy markup, not just how it looks in the source.

Is my HTML uploaded anywhere?

No. Parsing and formatting both happen locally in your browser — nothing you paste in is sent to a server.

Does minify remove all unnecessary whitespace?

It removes comments and collapses runs of whitespace to a single space, but it deliberately doesn't strip whitespace next to block-level elements the way an aggressive minifier would — that requires knowing every tag's default CSS display type, and getting it wrong can visibly break spacing. This tool prioritizes never changing how the page renders over squeezing out the last few bytes.