Developer Tools Runs in your browser Free · no account

XML Validator Online

The XML validator confirms that a document is well-formed and, when it is not, reports the parser error with its position. It also summarises the document: root element, element count and maximum nesting depth.

XML to validate 0 characters
Validation result

Your result will appear here.

Not sure where to start? Use Load example.

Results update automatically and are calculated on your device. Nothing you type is sent to a server.

Runs in your browser. Processing happens entirely in your browser. Nothing you enter is sent to Delimiter.live.

How to use the XML Validator

  1. Paste the XML document you want to check.
  2. A valid document returns a structure summary; an invalid one returns the parser error and its position.
  3. Fix the reported problem and validate again.

Example

Input
<a><b></a>
Output
Not well-formed
Mismatched tag: expected </b> but found </a>.

Common XML syntax errors and how to fix them

Nearly every well-formedness error is one of these. The validator reports the first one it meets, with its position.

Example Problem Fix
<title>Hello Unclosed tag Close every element, <title>Hello</title>, or self-close an empty one as <br/>
<b><i>x</b></i> Tags closed in the wrong order Close elements in the reverse order they were opened
Fish & Chips Unescaped ampersand Write &amp;, or wrap the text in a CDATA section
a < b Unescaped less-than sign in text Write &lt;
<item id=5> Unquoted attribute value Quote every attribute value: id="5"
<a x="1" x="2"> Duplicate attribute Each attribute name may appear once per element
<a/><b/> More than one root element Wrap everything in a single root element
<Item></item> Tag names that differ in case Names are case-sensitive, so match them exactly
&nbsp; An HTML entity XML does not define XML has only &amp; &lt; &gt; &quot; &apos; — use &#160; instead
<1st> Name starting with a digit Element names must start with a letter or underscore
␣<?xml …?> Something before the XML declaration The declaration must be the very first thing in the file — no space or blank line before it

Common use cases

  • Finding the unclosed tag in a document a parser rejected.
  • Checking a generated feed before publishing it.
  • Confirming an SVG or configuration file is well-formed after editing.
  • Checking a sitemap.xml or RSS feed before submitting it, since a feed that is not well-formed is rejected outright.

Limitations and things to watch for

  • This checks well-formedness only — that tags are balanced, attributes are quoted and the document has a single root. It does not validate against a DTD, XSD or RelaxNG schema.
  • Browser parsers report the first error and stop, so fixing one problem may reveal another.

Frequently asked questions

What does "well-formed" mean?
That the document follows XML syntax rules: one root element, every tag closed and correctly nested, attributes quoted, and reserved characters escaped. It is a lower bar than schema validity.
Can it validate against my XSD schema?
No. Schema validation needs the schema itself and a validating processor, which is beyond what a browser tool can do reliably. This tool checks well-formedness only.
Why does it only show one error?
Once an XML parser hits a structural error it can no longer trust the rest of the document, so it stops. Fix the reported error and run it again.
What is the difference between well-formed and valid XML?
Well-formed means the document follows XML syntax. Valid means it also conforms to a schema — a DTD or XSD that says which elements may appear where. Every valid document is well-formed, but not the reverse. This tool checks well-formedness.
Does it check sitemaps, RSS feeds and SVG files?
It checks that they are well-formed XML, which is the most common reason they fail. It does not check that they follow the sitemap, RSS or SVG specification — a feed can be perfect XML and still be missing a required element.

Share this tool