Using HTML Formatter
Indent a short HTML fragment first and check the nesting. Formatting can make an unclosed element easier to notice, but browser error recovery and the structure of the source are not always the same thing.
What to check in the result
Whitespace inside preformatted text, scripts or styles can be meaningful. Keep the original when exact output matters. Formatting does not repair every invalid document or remove unsafe markup.
Questions about HTML Formatter
Does prettier indentation repair invalid HTML?
No. Readability improvements do not necessarily fix mismatched tags or application logic.