XML Validator

Check if your XML content is well-formed.

Formatters & Validators

Validate XML Syntax Online: Catch Fatal Errors, Unclosed Tags, & Entity Bugs

You submit your website's sitemap to Google Search Console, submit your podcast feed to Apple Podcasts, or send an invoice batch to a vendor's SOAP API. Minutes later, your submission is rejected with a blunt error: "XML parsing failed: XML document structures must start and end within the same entity."

Unlike standard web browsers that happily render messy, malformed HTML without complaining, the official W3C XML specification requires parsers to halt immediately on the very first fatal error. If you forget to close a single tag or leave a naked ampersand in a URL, the entire document fails to load.

Our free XML Validator checks your XML markup against strict W3C well-formedness rules. Get instant feedback on line numbers, column positions, unclosed tags, and unescaped entities right in your browser before publishing sitemaps or deploying production feeds.

The 5 Most Common XML Fatal Errors (And How to Fix Them)

1. Naked Ampersands (&) in URLs

The single most frequent error in XML sitemaps. If a URL contains query parameters like page.php?cat=shoes&sort=asc, the raw & breaks the parser because XML interprets it as the start of an entity.

Fix: Always encode as & → page.php?cat=shoes&sort=asc

2. Case Sensitivity Mismatches

Unlike HTML, XML is strictly case-sensitive. A tag opened as <Item> cannot be closed with </item>. They must match letter-for-letter.

Fix: <Item> ... </Item> or <item> ... </item>

3. Improper Tag Nesting (Overlapping Tags)

Tags must close in reverse chronological order of their opening. Writing <title><b>My Page</title></b> is illegal in XML.

Fix: <title><b>My Page</b></title>

4. Missing Quotation Marks on Attributes

In HTML5, attribute quotes are sometimes optional. In XML, omitting quotes around attributes like <link rel=canonical /> causes an instant fatal parsing failure.

Fix: <link rel="canonical" />

5. Multiple Root Elements

Every XML document must have exactly one root element that wraps all other children. Having two sibling tags at the root level violates core XML specification.

Fix: Wrap sibling roots inside a single container like <root>...</root>

Well-Formed vs. Valid XML: What Is the Difference?

Well-Formed XML

A document that satisfies fundamental XML syntax rules: balanced tags, proper nesting, quoted attributes, and a single root element. Any modern XML parser can parse a well-formed document into a DOM tree without crashing.

Valid XML

A document that is both well-formed and adheres to a specific formal schema definition (DTD or XSD). For example, a sitemap must contain specific tags like <urlset> and <loc> to be considered valid by Google.

Frequently Asked Questions

How do I include special characters inside XML text nodes?

The five pre-defined XML entities are: &lt; for <, &gt; for >, &amp; for &, &quot; for ", and &apos; for '. Alternatively, wrap large blocks of arbitrary text in a CDATA section: <![CDATA[ arbitrary text & symbols ]]>.

Why does Google Search Console say "General HTTP error" on my sitemap?

Often this happens when a dynamic PHP script returns an XML content-type header but outputs an unescaped PHP warning or white line before the <?xml declaration. Validating your live URL output here catches these hidden syntax breaks.

Does this tool inspect files locally?

Yes. Validation runs through the browser's native DOMParser engine on your machine. None of your XML payload or API configurations are uploaded to any server.