Skip to content
Devtoolry

XML Validator

Validate XML online and check that it is well-formed. Syntax errors are reported with their exact line and column, so broken tags are easy to find.

Runs in your browser · Nothing uploadedFree · No sign-up

Something not working, or missing a feature? Send feedback

About the XML Validator

The XML Validator checks that a document is well-formed (properly nested and closed tags, quoted attributes, a single root) and shows the exact location of the first syntax error. Use it as an XML syntax checker: paste the code or open an XML file to check it before it reaches a parser.

Everything runs in your browser, so your input is never uploaded to a server.

How to use the XML Validator

  1. Paste XML or open a file.
  2. Read the result or the error with its line and column.
  3. Fix the problem and validate again.

Example

Find a mismatched closing tag

Input

<order id="1042">
  <customer>Ada Lovelace</customer>
  <items>
    <item sku="A-1">Notebook</item>
  </itemz>
</order>

Result

Error: Line 5, column 10: Unexpected closing tag: itemz != items

The first problem is reported with its line and column: here the closing </itemz> does not match the open <items>.

Common mistakes

  • Unescaped special characters. Inside text and attribute values, & must be written as &amp; and < as &lt;. A bare ampersand in a URL query string is the most common cause of "not well-formed".
  • More than one root element. A document must have exactly one top-level element. Two sibling elements at the top, for example from concatenated files, are an error; wrap them in a parent element.
  • Expecting schema validation. Well-formed XML can still break a consumer that expects certain elements. This tool checks syntax, not a DTD or XSD schema.

Works well with the XML Validator

Frequently asked questions

What is the difference between well-formed and valid XML?

Well-formed means the syntax is correct. Valid means it also matches a schema (DTD or XSD). This tool checks well-formedness.

Does it check namespaces?

Namespace prefixes must be declared to be well-formed, so undeclared prefixes are reported.

Why is only the first error shown?

XML parsers stop at the first syntax error, because everything after it may be read differently. Fix it and validate again to find the next one.

Is my XML uploaded?

No. It is parsed by your browser’s XML parser and never leaves your device.