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.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
Ctrl+Enter to validate

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. This flexibility 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 -->

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

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

Unescaped Special Characters

Characters like &, <, and > must be escaped as &amp;, &lt;, and &gt; when used in text content.

<title>A & B</title>       <!-- invalid -->
<title>A &amp; B</title>  <!-- valid -->

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

Frequently Asked Questions

What is the difference between well-formed and valid XML?
Well-formed XML follows basic syntax rules: proper nesting, matched tags, quoted attributes, and a single root element. Valid XML goes further -- it also conforms to a specific schema (DTD, XSD, or RelaxNG) that defines which elements and attributes are allowed. All valid XML is well-formed, but not all well-formed XML is valid against a particular schema.
What is the difference between XML and HTML?
XML is stricter than HTML. In XML, all tags must be closed, tag names are case-sensitive, attribute values must be quoted, and there are no predefined elements. HTML is more forgiving -- browsers can render HTML with unclosed tags and unquoted attributes. XML is designed for data transport, HTML for display.
Why does my XML parser fail on special characters?
XML reserves certain characters for its syntax: < (less than), > (greater than), & (ampersand), ' (single quote), and " (double quote). When these characters appear in text content or attribute values, they must be replaced with XML entities: &lt;, &gt;, &amp;, &apos;, and &quot; respectively.
Is this XML validator free to use?
Yes, our XML validator is completely free with no limits on usage. No registration or account required. Paste your XML, validate it, and get detailed error reports as many times as you need.
Can I validate XML against an XSD schema?
Our validator currently checks XML well-formedness -- the fundamental syntax rules that every XML document must follow. Schema validation (XSD, DTD, RelaxNG) is a planned feature for a future update.
Why is XML case-sensitive but HTML is not?
XML was designed to be strict and unambiguous for machine-to-machine data exchange. Case sensitivity eliminates ambiguity -- <Name> and <name> are different elements in XML. HTML was designed for human authoring with browser tolerance, so browsers treat <DIV> and <div> as the same element.
How do I handle namespaces in XML?
XML namespaces prevent element name conflicts when combining documents from different sources. They are declared using xmlns attributes with a URI prefix. For example: <book xmlns:isbn="urn:isbn"> lets you use <isbn:number> without conflicting with other elements named 'number'. Our validator checks that namespace declarations are well-formed.

Related Tools