HTML formatter
Pretty-print HTML with proper nesting indentation, without ever touching pre, script or style content.
Related tools
HTML formatter
Paste minified, copied or just messy HTML and get it back properly indented: every nested element steps in by your chosen indent (two spaces, four spaces or tabs), void elements such as br, img, input, meta and link are treated as non-nesting, and inline elements like a, b, em, strong, span and code stay on their parent's line whenever the whole element fits — so short list items and links stay compact instead of exploding into three lines each.
The formatter is deliberately forgiving, because HTML in the wild is malformed. Mismatched or unclosed tags never produce an error: a stray closing tag is dropped, an unclosed element is closed implicitly by its parent, and the rest of the document formats as best it can. The content of pre, script and style elements passes through verbatim — your preformatted text keeps its spacing and your embedded JavaScript and CSS are never re-indented or reflowed.
Two cleanup options handle the usual noise. "Remove blank lines between elements" strips the empty lines that pile up when markup is copied from templates, and "Collapse whitespace in text" turns runs of spaces and line breaks inside text nodes into single spaces — never inside pre, script or style. The tally under the output reports elements, lines in and out, and the deepest nesting level.
Everything runs locally in your browser: pages, templates and email markup never leave your machine. Copy the result or download it as a .txt file.