XML validator (well-formedness)

Paste XML before sending it to a system or gateway to find the error that stops it from being read.

Loading the tool…

Processing and privacy: The result is calculated inside your browser and your data is not sent to any server.

How to use it

  1. Enter xml text.
  2. The result appears straight away and updates as you edit.
  3. Copy the result, or copy a link that keeps the same values to share it.

How it is calculated

The parser walks the document and applies the XML 1.0 well-formedness rules: one root element, every opening tag closed in order, attributes as name="value" without repeats, every & starting a defined entity, no text outside the root. The first violation is shown with its line and column.

Example

Result: Result: Well-formed; Root element: catalog; Elements: 9.

Limits and caveats

  • It checks well-formedness only, not validity against an XSD or DTD schema.
  • Only the first error is shown, fix it and check again to see the next one.
  • Entities declared inside a DOCTYPE are treated as undefined.

Questions about this tool

Well-formed versus schema-valid?

Well-formed means the XML grammar rules are met. Schema-valid also means the elements and values match a given XSD or DTD, which this tool does not check.

What are the most common XML errors?

An unclosed tag, wrong closing order such as <a><b></a></b>, an unescaped & in text, and more than one root element.

Why is &nbsp; rejected?

It is an HTML entity, not one of the five XML entities, so replace it with the numeric reference &#160;.