Developer tools

XML Validator

XML Validator

Check XML is well-formed and see the exact line and column of each error.

About this tool

About XML Validator

When an import fails with "XML parsing error" or a feed reader refuses your file, paste the XML here to see exactly what is wrong. The validator checks well-formedness, the rules every XML document must follow, and stops at the first problem with its line and column and a plain explanation: a closing tag that does not match the one opened (including case differences like <Item> and </item>), a missing closing tag, text or a second element after the root, an unescaped & or < in text, an attribute without quotes, a duplicate attribute, an HTML entity such as &nbsp; that XML does not know, or an XML declaration that is not at the very start. When the document passes, you get a summary with the root element, the number of elements and attributes and the nesting depth, plus a neatly formatted copy. Your browser's own XML parser double-checks the result. Nothing is uploaded, so invoices, feeds and SOAP payloads stay private.

Built and maintained by Abhi JainUpdated

How to Validate XML

  1. 1

    Paste or open XML

    Paste XML into the left pane or open an .xml file.

  2. 2

    Read the result

    An error shows its line, column and reason. Valid XML shows a summary with the root element and counts.

  3. 3

    Fix and recheck

    Edit the XML on the left; the check reruns as you type. Copy the formatted version when it passes.

XML Validator: questions and answers

What is the difference between well-formed and valid XML?

Well-formed XML follows XML's syntax rules, so any parser can read it. Valid XML is also well-formed and matches a specific DTD or XSD schema. This tool checks well-formedness, which catches the errors that stop parsers.

Why does my XML fail with an error about &?

A plain & in text or an attribute must be written as &amp;, because & starts an entity reference. The same goes for < which must be written as &lt;.

Are XML tag names case-sensitive?

Yes. <Item> and </item> are different tags, so that pair is an error.

Can an XML file have two root elements?

No. A document has exactly one root element. Wrap the elements in a single parent, for example <items>…</items>.

More XML Formatter presets