Before touching the layout, this tool validates your document with the browser's real XML parser (DOMParser in application/xml mode) and shows the first two lines of the parser error if it fails. Only well-formed XML gets reformatted — a two-space indent per nesting level, one tag per line wherever tags are adjacent.
Validation is a real parse, not tag counting
Because a genuine XML parser runs first, this catches the errors regex-based pretty-printers miss: mismatched case (<Item> closed by </item> — XML is case-sensitive), a second root element after the first one closes, and attribute values missing quotes. The one that surprises people most is entities: XML predefines exactly five (&, <, >, ', "), so — perfectly legal in HTML — is an undeclared-entity error here unless your document declares it in a DTD.
That same strictness means this is the wrong tool for ordinary HTML. Void elements like <br> and <img> without self-closing slashes are well-formed HTML but fatal XML errors. It works well on XHTML, SVG, RSS feeds, Maven POMs, and Android layout files — anything that is actually XML.
How the indenter treats mixed content and minify treats whitespace
The reformatter only breaks lines between adjacent tags (>< with nothing but whitespace between). An element mixing text and inline tags — <p>Hello <b>world</b> again</p> — stays on one line untouched, which is correct: splitting it would inject whitespace into your text content. Declarations, comments, and self-closing tags never increase depth.
Minify is more aggressive than Format: it removes whitespace between tags and also collapses any run of two or more whitespace characters to a single space, including inside text nodes. If your document carries whitespace-significant content — xml:space="preserve" is not honored — minify will alter it, so keep such documents to Format only.
For ordinary HTML — the documents this validator rejects — the code minifier's HTML mode is the right tool, and the JSON formatter applies the same validate-first discipline to JSON payloads.