XML well-formedness checker

Paste a document below — or upload a file — then press **Check**. If it is well-formed you get a confirmation with the element count and root element, and a one-click hand-off to query it. If it is not, you get the parser's message, the failing line, and a plain-English explanation of the cause. Nothing is checked while you are mid-typing, and everything runs in your browser: the document is never uploaded.

Example — Bare & in text

<?xml version="1.0"?>
<links>
  <link>https://example.com/?a=1&b=2</link>
</links>

EntityRef: expecting ';' — the & must be written &amp;, even inside a URL.

Paste your own document into the checker on this page to see its errors, or open the Sandbox to query a well-formed one.

Well-formed is not the same as valid

The two words get used interchangeably and they are not the same thing. **Well-formed** means the document obeys XML's own syntax rules: one root element, every element closed, tags nested rather than overlapping, attribute values quoted, and & and < escaped in text. **Valid** means it also conforms to a schema — a DTD, XSD, or RELAX NG grammar that says which elements are allowed where.

This checker covers the first one. It reports the syntax errors that stop a document from parsing at all, which is the class of error that blocks every downstream tool. Schema validation against a DTD or XSD is not something this page does.

The errors that actually show up

Almost every real well-formedness failure is one of a handful of mistakes.

  • A bare & in text — it must be &amp;, even inside a URL query string.
  • A < in text content, which the parser reads as the start of a tag.
  • Mismatched or unclosed tags, including <br> copied out of HTML instead of <br/>.
  • Overlapping elements — <b><i>text</b></i> is HTML habit, not XML.
  • Two root elements, usually from concatenating two files.
  • Unquoted attribute values, or a stray " inside a quoted one.
  • Content before the XML declaration, including an invisible byte-order mark.

After it parses

A checker that only says yes or no is not much help. Once the document parses you are already in a workbench: query it with XPath 1.0 or 3.1, transform it with XQuery, click any node to get its absolute path, or reformat it with the Format toggle. Namespaces are detected and their prefixes offered to you automatically.

Large files stay workable — parsed documents are cached and live evaluation relaxes automatically past a few megabytes, so typing never blocks on a re-parse.

Keep going