HTML Formatter & Beautifier
Beautify and format HTML markup with proper indentation.
About HTML Formatter
Paste minified or poorly-formatted HTML and get cleanly indented, readable markup back. Handles nested elements, void elements (img, br, input), inline vs. block elements, and attribute formatting. Also includes a minify mode to strip whitespace.
Use Cases
Cleaning up template exports, reading minified HTML from web scrapers, formatting email HTML templates, reviewing CMS-generated markup, documenting HTML snippets.
How It Works
Parses the HTML string token-by-token, tracking nesting depth to apply indentation. Block-level elements are placed on new lines; inline elements stay on the same line.
FAQs
Does it fix broken HTML?
It formats what you give it. Minor issues like missing closing tags may be fixed by the browser's DOMParser, but it is not a validator.
Does it format inline CSS or JavaScript?
Inline style and script content is preserved as-is without reformatting.