XML Validator

Validate XML well-formedness online. Shows parse errors, element count, depth, and attribute stats. Uses native browser DOMParser. 100% client-side.

100% private · runs locally

Paste XML and instantly see whether it is well-formed. The validator uses the browser's native DOMParser API and reports parse errors with context. On valid XML, it displays a summary of the document structure: element count, attribute count, text nodes, and maximum nesting depth.

XML input
Paste XML to validate

Related tools

Frequently asked questions

What does "well-formed" mean for XML?

A well-formed XML document follows the basic syntax rules of XML: every opening tag has a matching closing tag, elements are properly nested (no overlapping), attribute values are quoted, and special characters like < and & are properly escaped. Well-formedness is a prerequisite — a parser will refuse to process malformed XML.

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

A well-formed document follows XML syntax rules. A valid document additionally conforms to a schema (DTD, XSD, or RELAX NG) that defines what elements and attributes are permitted. This tool only checks well-formedness. Schema validation requires the schema document itself and tools like Saxon, Xerces, or xmllint.

Common XML errors and how to fix them

Unclosed tag: Every element needs a closing tag or be self-closing: <br/>. Unescaped characters: Use &amp;, &lt;, &gt; in content. Unquoted attributes: Always quote attribute values.

Does this tool support XML namespaces?

Yes. The browser's DOMParser fully supports XML namespaces (the xmlns attribute and namespace-prefixed elements). Namespace declarations are preserved and namespace-prefixed elements are correctly parsed.

Can I validate XHTML with this tool?

Yes, if your XHTML is served as XML (application/xhtml+xml). XHTML is a strict XML-based version of HTML, so well-formedness rules apply. However, this tool won't validate against the XHTML DTD — it only checks XML syntax.