It formats; it does not validate, and the page says so. Reporting "valid" because a document could be indented is telling you something the tool does not know.
Some elements have whitespace as content: pre, textarea, script and style. Re-indenting inside a pre destroys the code sample; a textarea gains leading spaces in its value. Those four are left untouched.
Void elements have no closing tag. Treat <br> as an opening one and everything after it indents one level deeper for ever — the most visible way a hand-written formatter fails.
And it does not parse to a tree. A tree round trip drops comments, CDATA and unusual doctypes. This is a token stream: everything that goes in comes out.
No, and it says so on the page. Validating means checking against the whole specification — entities, DTDs, namespaces, encoding declarations — and a tool that reports “valid” because it managed to indent a document has told you something it does not know. What it does report is the one class of fault it genuinely detects: a tag that never closes, and a closing tag that matches nothing.
Because whitespace inside it is content, not formatting. Re-indenting a pre block destroys the code sample it contains, and a textarea treated the same way gains leading spaces in its value. Script and style are left alone for the same reason. Those four elements are passed through exactly as they arrived.
Because they treat it as an opening tag. Void elements — br, img, input, hr, meta, link and the rest — have no closing tag in HTML, so nothing ever brings the indent back out, and the rest of the document drifts right for ever. It is the single most visible way a hand-written formatter fails, and this one knows the list.
No. It does not parse to a tree and re-emit, which is what drops anything the parser did not model — comments, processing instructions, CDATA, an unusual doctype. This works on a token stream: every token that goes in comes out, and only the whitespace between them changes. A formatter that silently deletes part of a document is far worse than one that leaves it oddly indented.
Because refusing is no use to somebody trying to see where it broke. The problems are listed and the formatted output is produced anyway, so you can look at the structure and find the missing tag. An unmatched closing tag is also deliberately not allowed to change the indent level — otherwise one mistake pulls every following line left and the whole document looks wrong.
No. Everything happens in your browser and nothing is transmitted or stored.
area, base, br, col, embed, hr, img, input, link, meta, param, source, track, wbr have no closing tag. Nothing brings the indent back out once one is entered, so the whole rest of the document drifts right.
Runs entirely in your browser. This formats rather than validates — well-formedness against the full specification is a larger claim than indenting supports. It reports the structural faults it genuinely detects and still produces output for a broken document. Nothing you type here is sent to our servers — the calculation runs entirely in your browser.