XML Validator
Find out whether your XML is well-formed and see precisely where it breaks.
Processed locally in your browser/ Your data stays in your browser.
What is XML Validator?
A well-formed XML document has exactly one root element, correctly nested and closed tags, quoted attribute values, unique attributes per element and properly escaped special characters. Parsers refuse anything else, often with unhelpful messages.
This validator checks well-formedness with the fast-xml-parser validator plus an extra single-root check. On success it reports the root element, number of elements and attributes, depth and comments. On failure it gives the error code, message, line and column, and an excerpt with a caret. Documents that declare entities are flagged with a security warning.
How does it work?
- Paste your XML into the input area.
- Read the status banner: well-formed or not.
- On error, use the line, column and caret excerpt to fix the problem and watch the result update.
- When valid, use the statistics to double-check the structure, then format or convert the XML.
Common use cases
- Checking a hand-edited configuration or sitemap before uploading it.
- Finding the unclosed tag in a large generated XML file.
- Verifying an XML request body before calling a SOAP or REST service.
- Teaching the difference between well-formed XML and XML valid against a schema.
Examples
Try this input in the tool above:
<?xml version="1.0" encoding="UTF-8"?>
<order id="42">
<customer>Ada</customer>
<items>
<item sku="A1" qty="2"/>
<item sku="B2" qty="1"/>
</items>
</order>Root element: <order> Elements: 5 Attributes: 5 Nesting depth: 3 Comments: 0 Size: 169 B
Privacy
XML Validator runs entirely in your browser. The text or files you provide are processed on your device and are not uploaded, logged or stored on our servers.
Limitations
This checks well-formedness only. It does not validate against a DTD, XSD or RelaxNG schema, and it does not fetch external resources.
Frequently asked questions
What is the difference between well-formed and valid XML?
Well-formed means the syntax is correct. Valid means the document also conforms to a schema (DTD, XSD). This tool checks well-formedness only.
Why is <a/><b/> rejected?
An XML document must have a single root element. Wrap the two elements in a parent, for example <root><a/><b/></root>.
Why do I get a warning about entities?
A DOCTYPE with <!ENTITY> declarations can be abused for “billion laughs” expansion or external file access (XXE) in parsers that resolve entities. This tool never expands them, but you should not feed such documents to a resolving parser.
Related tools
XML Formatter & Beautifier
Turn compressed or messy XML into a cleanly indented document that is easy to read and review.
JSON & Data
XML to JSON Converter
Turn an XML document into JSON, keeping attributes, repeated elements and text content in a predictable structure.
JSON & Data
JSON Validator
Check whether a piece of text is valid JSON and locate the exact character where it goes wrong.
JSON & Data
YAML Validator
Check that a YAML file is valid and find the exact place where it breaks.
JSON & Data
XML Minifier
Compress an XML document by removing the whitespace between elements and, optionally, comments.
JSON & Data
XML Escape
Make any text safe to place inside an XML element or attribute value.
JSON & Data