About the XML Validator
The XML Validator checks XML for well-formedness: matched tags, proper nesting, a single root element, quoted attributes, and valid entities. Errors show the line and column with the surrounding code, and valid documents can be formatted with indentation and downloaded.
How it works
Each time the input changes, it is parsed with the browser's DOMParser using the XML content type. XML parsers are strict: they stop at the first error instead of guessing, as HTML parsers do. If the result contains a parser error, the first line of its message is shown; otherwise you see "Valid XML".
The message comes from your browser, so wording differs between Chrome, Firefox, and Safari, but it typically names the problem and gives a line and column, which the tool uses to show the offending line. The check covers syntax only. A DOCTYPE or schema reference is not used to validate element names or structure.
How to use
- 1
Paste your XML into the box, or click Open file.
- 2
Read the result: well-formed, or an error with its location.
- 3
Fix the highlighted line, then click Format to tidy the document.
Worked examples
Well-formed
A small document.
Mismatched tag
A closing tag that does not match.
Unescaped ampersand
A company name in text content.
In XML, a literal & must be written as &.
Frequently asked questions
What does well-formed mean for XML?+
It means the document follows XML syntax rules: one root element, every tag closed, proper nesting, quoted attributes, and escaped special characters.
Is this the same as schema validation?+
No. It checks syntax only. Validating against an XSD or DTD is a separate check.
Why does the error message look different in another browser?+
The message comes from the browser's built-in XML parser, and each browser words its errors differently.
Can I validate SVG or RSS files?+
Yes. Both are XML, so paste their source to check for well-formedness.