HTML Formatter

Re-indent HTML with consistent indentation and one tag per line, while keeping script, style, preformatted, and textarea content untouched inside.

An HTML formatter re-indents markup so every tag sits on its own line at a depth matching its nesting. Content inside script, style, pre, and textarea is left exactly as written.

Output

                

Paste or type something above.

Questions about html formatter

Why did the output lose my whitespace?
Whitespace between tags that only held indentation is dropped. Spaces inside text, pre, and textarea are kept.
Is the markup validated?
No. HTML parsing is forgiving, so a broken document still formats. Use a validator when you need errors.
Does it change self-closing tags?
Void elements such as img, br, and input stay void, so no closing tag is added.