XML Validator

Check whether XML is well-formed. If it is, you see the root element and counts of elements and attributes. If not, you get the parser message that explains what broke.

Use the tool

Why this tool exists

A missing closing tag, an unescaped ampersand or two root elements are enough to make an XML consumer reject a file, often with an unhelpful error far from the cause. Checking well-formedness before you send or commit the file saves a round trip.

This tool hands your text to the XML parser built into your browser, the same one that handles web pages, and shows its message when something is wrong. For a valid document it adds a short summary: the root element and how many elements and attributes it contains. Note that well-formed is not the same as valid against a schema or DTD, which this tool does not check. Everything stays in your browser.

How to use it

  1. Paste your XML into the input box.
  2. Read the first line: Well-formed XML, or Not well-formed with the parser message.
  3. For valid input, check the root element and counts shown below.
  4. Fix any reported problem and paste again.

Frequently asked questions

Is this the same as schema validation?

No. It checks well-formedness only: matching tags, quoting, escaping and a single root. It does not check against an XSD or DTD.

Why does the error message look different between browsers?

The message comes from your browser's own XML parser, and each engine words errors differently. The line and column it mentions are usually enough to find the problem.

What are common causes of errors?

Unescaped ampersands or less-than signs in text, unclosed or mismatched tags, attribute values without quotes, more than one root element and text before the XML declaration.

Does it work with large files?

Yes, within your browser memory. A few megabytes are no problem; very large files may be slow to paste and parse.