XML Formatter & Validator
Pretty-print or minify XML and check it is well-formed, each error placed at a line and column: mismatched tags, second root, bare ampersand, unquoted values.
Clean, indented XML (or a one-line minified version) and a plain verdict on well-formedness with the exact position of the first problem — nothing uploaded.
Example: A one-line order document becomes eight indented lines with <note/> self-closed; <a><b></a> is refused with "Line 1, column 7: Mismatched tag: <b> is closed by </a>".
Well-formed is a precise word,
and this page means exactly that.
What the parser checks, what formatting and minifying change, and why a DOCTYPE is carried but not obeyed.
What is checked
The document is read by a parser written on this page that follows the XML 1.0 well-formedness rules: exactly one root element; every start tag closed by a matching end tag in the right order; attribute values quoted and no attribute repeated on an element; "<" and a bare "&" never loose in text or attributes; only the five predefined references (< > & " ') and numeric ones; comments, CDATA sections and processing instructions terminated; the XML declaration first if present. The first violation is reported with its line and column and the offending line, because the point of a validator is to say where.
Formatting and minifying
Formatting rebuilds the tree with the indent you choose: elements that contain only text stay on one line, empty elements are written self-closed, whitespace-only text between elements is dropped and mixed content is trimmed unless you preserve whitespace. Attribute values are re-written in double quotes with any inner quote as "; attributes can be sorted A–Z. Minifying removes the same ignorable whitespace and the line breaks; comments, CDATA and the prolog are kept in both modes. Format → minify → format is stable, which the tests assert.
What it does not do
No validation against a DTD, XML Schema or RELAX NG: a DOCTYPE is carried through as text and entities it defines are not expanded, so a document that relies on them will be refused at the reference. Namespaces are treated as ordinary prefixed names. Encoding declarations are not honoured — the text you paste is already decoded by your browser. Nothing you enter leaves the browser; the same four anonymous usage counts as the rest of the site apply.
SOURCES
Last reviewed 19 September 2026. How results are checked: How we verify.