XML Validator

Check that an XML document is well-formed: one root element, properly nested and closed tags, quoted attribute values, escaped special characters and declared namespace prefixes. The result says Valid or Invalid in words with an icon, and an invalid document gets the line, column and a short explanation.

Format & Validate Runs in your browser

Validate Your XML

How to Use the XML Validator

  1. Paste your XML into the box.
  2. Press Check.
  3. Read the verdict. For an error, look at the line and column and the excerpt with the caret.
  4. Fix the problem and check again; only the first error is reported at a time.

About This Tool

Developers debugging feeds, sitemaps, SOAP messages or configuration files, and anyone who gets a vague “XML parsing error” from another program.

Input: XML  ·  Output: Validation report.

Features and Limitations

Features

  • Two checks: the browser's own XML parser and a built-in scanner that gives the same line and column in every browser.
  • Hints for the common mistakes: mismatched tags, unclosed elements, unquoted or duplicate attributes, unescaped &, HTML entities such as  , text outside the root, undeclared namespace prefixes.
  • For valid XML: root element, element and attribute counts, nesting depth, comments, CDATA, namespaces, declared encoding.
  • Runs entirely in your browser.

Limitations

  • This is a well-formedness check. It does not validate against a DTD or an XSD or RelaxNG schema.
  • DTD entities are not expanded and external resources are never loaded, so documents that depend on them may be reported as invalid.
  • Only the first error is shown.
  • Results are computed in your browser; nothing you enter is sent to a server.

Example

is invalid: “Closing tag does not match the opening tag ” at line 1, column 7.

Frequently Asked Questions

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

Well-formed means the syntax is correct (nesting, quotes, escaping). Valid means the document also follows the rules of a DTD or schema. This tool checks the first only.

Why is   an error?

XML defines only five named entities: < > & " and '. HTML names such as   or © must be written as numeric references like   or declared in a DTD.

Why must there be no space before <?xml?

The XML declaration must be the very first characters of the file. A leading blank line or space makes parsers reject the document.

Does it work for SVG, RSS or sitemaps?

Yes. Those formats are XML, so any syntax error in them is found. Their format-specific rules are not checked.

Are external entities fetched?

No. The page never loads external DTDs or entities, so pasting untrusted XML here is safe.

Related Tools

More like this: all Format & Validate tools, all Developer & Web tools or the TinySandy home page.