XML Validator
DataPaste any XML document and instantly check if it is well-formed. See the exact parse error and position — runs entirely in your browser, no signup needed.
What is a XML?
An XML Validator checks whether an XML document is well-formed — meaning it satisfies the strict syntax rules defined by the W3C XML 1.0 specification. XML (eXtensible Markup Language) is used for configuration files, data exchange formats (SOAP, RSS, SVG, AndroidManifest.xml), API responses, and document storage. Unlike HTML, which browsers parse leniently, XML is unforgiving: a single unclosed tag or unescaped & character causes the entire document to fail parsing.
This tool uses the browser's built-in DOMParser with the 'text/xml' MIME type — the same parser used by browsers when they process RSS feeds or SVG files. The result is therefore identical to what any standards-compliant XML parser will produce. If the parser inserts a <parsererror> element into the result tree (the standard mechanism for signalling a well-formedness error), the tool extracts and displays that error verbatim, including the line and character position.
Well-formedness covers structural syntax only. This tool does not validate against a DTD or XSD schema — it confirms the XML is parseable, not that it conforms to a specific data structure. For schema validation, you need a separate tool with the schema definition.
Validation runs entirely in your browser — no XML is transmitted or stored. Safe to use with configuration files, API responses, or any document containing internal data. See the JSON Validator for equivalent checks on JSON documents.
How to use this XML calculator
- Open the XML Validator on this page.
- Paste your XML document into the XML Input field.
- The result badge updates instantly. A green Valid badge confirms the document is well-formed.
- If the badge shows Invalid, read the error detail — it includes the line and character position of the parse failure.
- Navigate to that position in your XML, fix the structural error (missing closing tag, unescaped character, mismatched nesting), and paste the corrected XML back.
- Repeat until the Valid badge appears.
Formula & Methodology
The validator uses the browser's built-inDOMParser:js const parser = new DOMParser(); const doc = parser.parseFromString(xml, 'text/xml'); const errorNode = doc.querySelector('parsererror');Ifparsererroris present, the XML is not well-formed. The error text from that node is the browser's native parse error, including position information. Valid example:xml <root> <item id="1">Hello</item> </root>Result: Well-formed. Root element<root>, 1 child element. Invalid example (unclosed tag):xml <root> <item>Hello </root>Result: Not well-formed —<item>is not closed. Error at line 3, near</root>.