HTML Beautifier
format and indent HTML code with configurable settings
By Bikram NathLast updated
Paste minified or messy HTML and get back properly indented, nested markup in one click. Useful when a CMS export hands you a wall of tags with no whitespace — for example, a 4KB single-line Mailchimp template becomes scannable, attributed markup with configurable 2- or 4-space indentation. Unlike a general code editor's format-on-save, this runs entirely on the page with no install required.
Try it now — free, instant, no signup
What is HTML Beautifier?
HTML Beautifier takes raw HTML — minified, concatenated, or just inconsistently indented — and re-serializes it with correct hierarchical indentation and normalized whitespace. Feed it something like `<html><head><title>T</title></head><body><p>Hi</p></body></html>` and you get back a properly nested, multi-line document you can actually read and diff.
Developers reach for this when Prettier is overkill for a one-off task, or when the HTML they're looking at isn't part of a local project — scraped markup, a third-party widget's minified output, or an email template dropped into a support ticket. Tools like VS Code's built-in formatter require a file on disk; browser devtools pretty-print the live DOM, which diverges from source if JavaScript has mutated it. This tool formats the literal text you paste.
One thing to know: the formatter works on text, not on a parsed DOM tree. That means it won't catch or correct invalid nesting — unclosed tags, block elements inside inline elements, or duplicate IDs — it just re-indents whatever structure is already there. If you need validation alongside formatting, run the output through the W3C Markup Validator afterward.