HTML Formatter
Re-indent HTML with consistent indentation and one tag per line, while keeping script, style, preformatted, and textarea content untouched inside.
How to use
- Paste HTML into the input.
- Set the indent width.
- Copy the formatted markup.
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.
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.
Related tools
- HTML Minifier Strip comments and redundant whitespace from HTML to cut page weight, keeping one meaningf...
- XML Formatter Re-indent XML with consistent spacing and readable nesting, keeping the declaration, DOCTY...
- CSS Formatter Re-indent CSS so each declaration sits on its own line and nested at-rules are indented, w...