How it works
Indent of an element = its nesting depth × the chosen spaces (2 by default) | An element holding only text stays on one line: <name>fig</name> | Well-formed means every opening tag is closed in last-in, first-out order, and there is exactly one root element
Paste XML and the formatter walks it tag by tag, tracking nesting depth as it goes: opening tags descend a level, closing tags climb back, and each line is indented by its depth. An element whose only content is text — <name>fig</name> — stays on one line, because splitting it across three would make real documents longer without making them clearer. Comments, the XML declaration, processing instructions and CDATA sections are carried through as they are. Minify runs the same walk and joins everything back with the inter-tag whitespace removed.
Because the walk maintains the stack of open tags, the formatter also checks well-formedness as it goes, and it reports problems by name: a closing tag that does not match the innermost open element is reported as the pair that clashed, with its line, and a document that ends with tags still open names the unclosed element. Be clear about the boundary of that check: well-formed is not the same as valid. This tool cannot know your schema, DTD or business rules, so it will happily format a well-formed invoice whose totals are wrong — structure is checked, meaning is yours.
The everyday traps are worth naming: XML is case-sensitive (<Name> and <name> are different elements), attribute values must be quoted, and a raw & or < inside text must be written as an entity — the HTML Entity tool covers those spellings. Everything runs in your browser; pasted documents are never uploaded.