HomeValidatorsDataXML Validator

XML Validator

Data

Paste 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.

Reviewed by the thecalcu.com team · Last updated July 11, 2026

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.

Why Use an XML Validator?

XML errors are silent until a parser encounters them. A single missing closing tag in a 500-line config file causes the parser to reject the entire document; the error may appear far from the actual mistake, making it hard to diagnose from a cryptic error message alone.

Common scenarios:

  • Editing a large XML configuration file (Maven POM, Spring context, Android manifest) and needing to confirm the edit didn't break the structure
  • Receiving an XML API response that your parser is rejecting with a cryptic error, paste the raw body here to pinpoint the issue
  • Generating XML programmatically and verifying the output is well-formed before writing it to a file or sending it to an endpoint
  • Debugging SOAP integration failures where the XML envelope structure is malformed

Who Should Use This Validator?

Backend developers working with XML-based APIs (SOAP, OpenAPI in XML, REST endpoints that return XML) who need to confirm a request or response body is parseable before building code around it.

DevOps and platform engineers editing XML config files (Kubernetes CRDs in XML, ANT build scripts, Maven POMs) who want to catch structural errors before a build or deploy fails.

Android developers editing AndroidManifest.xml or layout XML files who want to confirm the file is well-formed before running a build.

Data engineers working with XML feeds (RSS, Atom, product catalogues) who need to validate documents before importing them.

For JSON equivalents, use the JSON Validator. For basic HTML structure checking, use the HTML Validator.

What Insights Does the XML Validator Give You?

When the document is valid, the tool confirms it is well-formed and shows the root element name and the count of direct child elements, a quick structural overview.

When the document is invalid, the tool shows the native parsererror text from the browser's XML parser, which includes the line number and character position of the first error. This is the definitive location, fix the error at that position first, then re-validate.

Scope: well-formedness only. The validator does not check namespaces against a schema, does not validate attribute types, and does not confirm that elements appear in the order a specific DTD or XSD requires.

How to use this XML calculator

  1. Open the XML Validator on this page.
  2. Paste your XML document into the XML Input field.
  3. The result badge updates instantly. A green Valid badge confirms the document is well-formed.
  4. If the badge shows Invalid, read the error detail, it includes the line and character position of the parse failure.
  5. Navigate to that position in your XML, fix the structural error (missing closing tag, unescaped character, mismatched nesting), and paste the corrected XML back.
  6. Repeat until the Valid badge appears.

Formula & Methodology

The validator uses the browser's built-in DOMParser:

js const parser = new DOMParser(); const doc = parser.parseFromString(xml, 'text/xml'); const errorNode = doc.querySelector('parsererror'); 

If parsererror is 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>.

Related Tools

You may also find these useful: MAC Address Validator.

Frequently Asked Questions

An XML Validator checks whether an XML document is well-formed, meaning it follows the syntax rules defined by the W3C XML specification. A well-formed XML document has a single root element, all tags are properly closed, attribute values are quoted, and no illegal characters appear in the content. This tool uses the browser's built-in XML parser, so the result is identical to what any standards-compliant parser will produce.
A well-formed XML document satisfies these rules: there is exactly one root element that contains all other elements, every opening tag has a matching closing tag (or is self-closed with `/>` for empty elements), tags are properly nested (no overlapping), attribute values are enclosed in single or double quotes, and the `<`, `>`, and `&` characters in text content are escaped as `&lt;`, `&gt;`, and `&amp;`. XML is far stricter than HTML in this regard.
Well-formed means the document follows XML syntax rules. Valid means the document also conforms to a schema, either a DTD or an XML Schema (XSD), that specifies which elements and attributes are permitted and in what structure. This tool checks well-formedness only. Schema validation requires a separate tool with the schema definition.
No. This tool performs well-formedness checking only, it does not validate against DTD, XSD, or RelaxNG schemas. If you need to check that your XML conforms to a specific schema (e.g. a SOAP envelope or a specific API response structure), you need a schema-aware validator. This tool catches structural errors: unclosed tags, bad attribute syntax, illegal characters.
The most frequent XML errors are: unclosed tags (forgetting the `</tag>` closing), improperly nested tags (opening A, opening B, closing A before closing B), unquoted attribute values, the use of `<`, `>`, or `&` directly in text content instead of their escaped forms (`&lt;`, `&gt;`, `&amp;`), and multiple root elements. The parser error message includes the position (line and character) where the problem was detected.
Yes. The parser does not care about whitespace or line breaks, minified and formatted XML are treated identically. Paste your XML in any form.
Nothing leaves your browser. The validation uses the browser's built-in `DOMParser`, which runs entirely in your browser process. Nothing is sent to a server. This makes it safe to validate XML containing internal data, API credentials in attributes, or any sensitive content.
HTML is designed to be forgiving, browsers silently fix unclosed tags, accept unquoted attributes, and handle overlapping tags. XML is strict: any syntax error causes the parser to stop and report a failure. XHTML is HTML written to follow XML rules. This validator uses the strict XML parser, not the lenient HTML parser.
Standard XML requires exactly one root element. If your document has two or more elements at the top level, wrap them in a single container element. For example, if you have `<a/>` and `<b/>` at the top level, write `<root><a/><b/></root>`. This is a common issue when concatenating XML fragments.
The browser's DOMParser in 'text/xml' mode may flag an error if the DOCTYPE references an external DTD that cannot be loaded. If your XML has a DOCTYPE declaration, try removing it before validating, the well-formedness check does not require the DTD to be present.
Yes, SOAP messages and API responses are XML and must be well-formed. Paste the XML body and this tool will confirm it parses correctly. Schema validation (confirming the SOAP envelope structure is correct) is a separate concern not covered by this tool.
Also known as
check xmlvalidate xml documentxml syntax checkeris my xml validxml well-formedness checkerxml parse error