HTML Formatter & Beautifier

Format and indent HTML markup for readability, with proper handling of void elements.

Loading tool…

How to use the HTML Formatter

  1. Paste your HTML markup into the input box.
  2. Click "Format HTML" to re-indent it with one element per line.

Why use this tool

Minified or inconsistently indented HTML is hard to scan for structure. This tool parses the markup with your browser's own HTML parser and re-serializes it with consistent indentation, correctly leaving void elements like <br> and <img> unclosed and preserving the raw contents of <pre>, <script>, and <style> blocks untouched.

Frequently Asked Questions

Will this fix broken or invalid HTML?

Browsers are very lenient when parsing HTML and will auto-correct many issues (like unclosed tags) the same way they would when rendering the page normally, but this tool does not flag or report those issues explicitly.

Does it reformat the contents of <script> or <style> tags?

No, their contents are preserved exactly as-is, since re-indenting embedded CSS or JavaScript as plain text could change its meaning.