The Util Box

XML Validator

Free online xml validator for developers. Validate XML syntax and structure. Fast and private.

Embed this tool

Copy and paste the code below into your website to embed this tool for free. An attribution link to The Util Box is required.

<iframe src="https://www.theutilbox.org/embed/xml-validator" width="600" height="500" frameborder="0" style="border: none; max-width: 100%;" title="Free XML Validator tool from The Util Box"></iframe>
<!-- Free tool by The Util Box — https://www.theutilbox.org/tools/xml-validator -->
<a href="https://www.theutilbox.org/tools/xml-validator">XML Validator by The Util Box</a>

Frequently Asked Questions about XML Validator

XML Validator — Check Tags Are Properly Nested

This XML validator checks that your tags are correctly opened and closed. It reports an unexpected closing tag, a closing tag that does not match the one it was supposed to close, and any tags left open at the end — with the specific tag names, so you know where to look.

It works by walking the document and keeping a stack of the tags currently open. A closing tag has to match the top of that stack.

What It Checks and What It Does Not

The check is about nesting. Comments and CDATA sections are skipped, so their contents are never mistaken for tags.

It is not a full XML validator, and that distinction matters:

  • A document with two root elements passes, because the check only verifies that tags are balanced.
  • Attribute syntax is not checked — an unquoted attribute value, a duplicate attribute or a missing quote will not be reported.
  • Entity references are not resolved, so an undefined &foo; passes.
  • No schema or DTD validation happens, so a document can be well formed and still be invalid against its schema.
  • A > inside an attribute value ends the tag early, and the check then reports a mismatch that is really a parsing artefact.

The Three Errors It Reports

Message What it means
Unexpected closing tag: </x> A closing tag arrived with nothing open — either a stray closing tag, or two roots where one was expected.
Mismatched tags: <a> closed by </b> The closing tag does not match the one it should have closed. The report names both, which usually makes the fix obvious.
Unclosed tags: <a>, <b> Tags were opened and never closed, listed in the order they were opened so you can match them against the document.

Each error is reported on its own line, so a document with several problems gives you the whole list at once rather than only the first failure.

Related Developer Tools

The validation runs entirely in your browser — your XML is never uploaded.