XML Validator
Find out whether your XML is well-formed, and if not, exactly where the first problem is and how to fix it.
or drop a file here · .xml, .txt · up to 20 MB
About the XML Validator
When an import fails with a vague “XML parsing error”, the cause is usually small: a tag closed in the wrong order, an ampersand in a company name, an attribute without quotes. This validator reads the file the way a strict XML parser does and reports the first place where it breaks the rules, with a caret under the exact character.
When to use it
- An e-invoice, bank statement or feed upload was rejected and you want to know why.
- You edited a configuration file by hand and want to be sure it still parses.
Worked example
Select Try an example. The sample has a deliberate mistake: the title of the second book is closed with “titel” instead of “title”. Select Validate XML.
The page gives the line and column of the bad closing tag, says it does not match the title element,. Correct the spelling and validate again; the page now confirms well-formed XML and counts the elements and attributes.
Another frequent case is a name such as Patel & Sons. A bare “&” is an error in XML; write it as & and the check passes.
What is checked
- Exactly one root element, with only comments and processing instructions outside it.
- Every start tag has a matching end tag, closed in the right order.
- Attribute values are quoted, and no attribute appears twice on one element.
- Entity references are built-in, numeric, or declared in the file’s own DTD.
- Names are valid and any XML declaration comes first.
- Namespace prefixes such as soap: are declared with an xmlns attribute.
Limits
- This is a well-formedness check, not schema validation. A file can pass here and still be rejected because an XSD or DTD requires a field that is missing.
- Only the first error is shown, because later ones are often caused by it. Fix it and check again.
- For other formats, use the JSON validator or the YAML validator.
How to use XML Validator
- Paste XML or open an .xml file.
- Select Validate XML.
- Fix the reported problem, then validate again until it says the XML is well-formed.
Privacy: how it works
Everything happens in your browser. Your text is not sent to any server.
Frequently asked questions
What does it check?
The XML 1.0 well-formedness rules: one root element, matching start and end tags, quoted attribute values, no duplicate attributes, valid entity references such as &, valid names, and declared namespace prefixes.
Does it validate against an XSD schema or DTD?
No. A file can be well-formed and still not match the schema a program expects. This tool checks the syntax only.
Why is "&" in my text an error?
In XML a bare & starts an entity. Write & instead, or put the text in a CDATA section. The same goes for < in text, which must be written <.