XML Validator

Paste XML and find out at once whether it is well-formed. If not, you get the first problem in plain words, such as a closing tag that does not match, an unquoted attribute, a stray & or a second root element, with its line and column and a pointer under the exact spot. Valid files show their root element and how many elements and attributes they hold.

Action
XML
Checked XML

Well-formed XML: root <invoice>, 10 elements, 7 attributes, 4 levels deep.

Checks the XML rules every parser enforces. It does not check against a DTD or XSD schema.

Processing runs in your browser. What you type never leaves this device.

Features

  • Exact line and column of the first error

  • The broken line shown with a pointer

  • Plain explanations for each kind of error

  • Root element, element, attribute and depth counts

  • Format or minify once it passes

  • Runs in your browser

When to validate XML

Sitemaps that will not submit

Search engines reject sitemaps with a single unescaped & in a URL. Find it here.

Feeds and integrations

Check RSS, podcast and partner XML feeds before they break an importer.

Hand-edited config

Catch a missing closing tag in pom.xml, web.config or an Android layout before a build fails.

The rules of well-formed XML

What is checked

  • Exactly one root element, with nothing but comments and processing instructions around it.
  • Every start tag closed, in the right order; names valid.
  • Attribute values in quotes, no attribute twice on one element.
  • & only as part of an entity (&amp; &lt; &gt; &quot; &apos; or a numeric one); no < inside attribute values.
  • The <?xml ?> declaration, if present, at the very start.

Well-formed versus valid

Schema validation (DTD or XSD) checks which elements are allowed where. This tool checks well-formedness, the rules every parser enforces first. For sitemaps, the sitemap validator also checks sitemap rules.

Related tools

Tidy valid XML with the XML formatter.

XML Validator - FAQ