Free XML Validator
Paste your XML code to check for syntax errors, unclosed tags, and well-formedness issues. Get a quality score with detailed error reports.
Well-Formedness Check
Verify that your XML follows all well-formedness rules: proper nesting, matched tags, correct attribute syntax, and valid character encoding.
Error Pinpointing
Get exact line and column numbers for every issue. Quickly jump to the problem and fix it without hunting through your code.
Quality Score
Get a 0-100 score and letter grade for your XML quality. Track improvements as you fix issues in your documents.
What Is XML Validation?
XML (Extensible Markup Language) is a markup language designed to store and transport structured data. Unlike HTML, XML has no predefined tags. You define your own elements and structure, which makes strict validation essential.
XML validation has two levels. The first is well-formedness: the document must follow XML syntax rules such as proper tag nesting, matched opening and closing tags, quoted attribute values, and correct use of special characters. A document that breaks any of these rules is not valid XML and cannot be parsed.
The second level is schema validation, which checks whether the document conforms to a specific structure defined by a DTD, XML Schema (XSD), or RelaxNG schema. Our validator focuses on well-formedness, the foundation that every XML document must satisfy before any schema validation can occur.
Common XML Errors
Unclosed Tags
Every opening tag must have a corresponding closing tag. Unlike HTML, XML does not auto-close tags.
<name>John <!-- invalid --> <name>John</name> <!-- valid -->How to fix unclosed tags→
Mismatched Tags
Opening and closing tags must match exactly, including case. <Name> cannot be closed with </name>.
<Name>John</name> <!-- invalid --> <Name>John</Name> <!-- valid -->How to fix mismatched tags→
Unquoted Attributes
All attribute values must be enclosed in quotes (single or double). Unquoted values are a syntax error.
<book id=1> <!-- invalid --> <book id="1"> <!-- valid -->How to fix unquoted attributes→
Unescaped Special Characters
Characters like &, <, and > must be escaped as &, <, and > when used in text content.
<title>A & B</title> <!-- invalid --> <title>A & B</title> <!-- valid -->How to fix unescaped special characters→
Improper Nesting
Tags must be properly nested. You cannot close a parent tag before closing its children.
<a><b></a></b> <!-- invalid --> <a><b></b></a> <!-- valid -->
Multiple Root Elements
An XML document must have exactly one root element. Multiple root elements make the document invalid.
<a/><b/> <!-- invalid --> <root><a/><b/></root> <!-- valid -->How to fix multiple root elements→
Invalid XML Declaration
The declaration must be the very first thing in the file, with no whitespace or comment before it, and its attributes come in a fixed order.
<!-- hi --> <?xml version="1.0"?> <!-- invalid --> <?xml version="1.0"?> <!-- valid, first line -->How to fix invalid xml declaration→
Browse every XML error guide for the rest, each with the wrong and right version side by side.