XML Validator
This XML validator checks that your XML is well-formed and shows exactly what to fix when it isn't.
XML input
Validation result
Invalid XML
Error on line 7, column 16: “&” must be written as & (or start an entity like <).
How to validate XML
- Paste XML on the left, or open or drop an .xml file.
- See instantly whether it's well-formed. Errors show the line, the column and how to fix them, and the line is highlighted.
- Click Go to error, fix it in the editor, and the result updates as you type.
Well-formedness, explained
XML parsers are strict: a single unescaped & or a tag closed in the wrong order makes the whole document unreadable. This XML checker applies the XML 1.0 well-formedness rules — properly nested and closed tags, a single root element, quoted and unique attributes, valid names and entities — and stops at the first problem, just like a real parser, with an explanation you can act on.
Valid documents show a summary: the root element, how many elements and attributes it has, and how deeply it's nested.
Common XML errors and fixes
| Problem | Invalid | Valid |
|---|---|---|
| Unescaped ampersand | <t>AT&T</t> | <t>AT&T</t> |
| Mismatched tags | <a><b></a></b> | <a><b></b></a> |
| Unquoted attribute | <img width=10/> | <img width="10"/> |
| HTML entity | <p> </p> | <p> </p> |
| Two root elements | <a/><b/> | <root><a/><b/></root> |
Example: reading an error message
Here the company name contains a bare &, which XML reserves for entities:
<order>
<item>AT&T router</item>
</order>The validator stops at line 2, column 11 and reports: “&” must be written as & (or start an entity like <). Replacing the character with & fixes it — or wrap longer text that contains many special characters in a <![CDATA[ … ]]> section.
<order>
<item>AT&T router</item>
</order>Use cases
- Find why an RSS feed, sitemap or SVG fails to load.
- Check SOAP requests and XML API payloads before sending them.
- Debug build and configuration files such as pom.xml or web.config.
Other XML tools
Once the XML is valid, indent it with the XML formatter or explore it in the XML viewer. Validating other formats? The JSON validator and YAML validator work the same way, and the HTML validator checks web pages.
Frequently asked questions
- What does the XML validator check?
- Whether the document is well-formed: every tag closed and correctly nested, one root element, attribute values quoted, no duplicate attributes, valid names, and only defined entities and valid character references.
- Does it validate against an XSD or DTD schema?
- No. It checks well-formedness, which is what every XML parser requires first. Schema validation (XSD, DTD, RELAX NG) checks your own rules on top of that and isn't done by this tool.
- Why is an error in XML?
- XML only defines five named entities: <, >, &, " and '. HTML entities like or © don't exist in XML unless a DTD declares them. Use numeric references such as   instead.
- Is my XML uploaded?
- No. The XML is checked in your browser and never leaves your device.
- How is this different from the W3C validator?
- The W3C Markup Validation Service is built mainly for HTML; it can also check an XML document against a DTD the document declares. This tool checks XML 1.0 well-formedness — the rules every XML parser enforces — runs entirely in your browser and explains the first error in plain language. It doesn't validate against a DTD or XSD schema, so use a schema-aware tool or your IDE when you need that.