← All tools
/ to focus
// XML / Developer

XML Validator online

Validate XML for well-formedness — line & column errors, stats, namespace detection

Chunky Munster XML mascot
by
CHUNKY
MUNSTER
// TRY AN EXAMPLE
// XML input ● live
// paste or type XML above to validate

How to Use xml-validator

  1. Paste your XML document into the input area.
  2. The validator checks well-formedness using the browser's native XML parser.
  3. Any errors are reported with the line number, column, and description of the problem.
  4. Fix the indicated issues and re-validate until the document is confirmed well-formed.

XML validation is a routine step before sending data to SOAP endpoints, importing configuration files, submitting feeds to Google Merchant or Apple AppStore, or processing any XML pipeline. This validator uses the browser's built-in DOMParser — the same engine that processes web pages — to check well-formedness and report the first error with precise location information.

Common XML Validation Errors

Unclosed element: <name>Alice without </name>. Mismatched tags: <b><i>...</b></i>. Unescaped special characters: bare & or < in text content. Multiple root elements: XML allows exactly one root element. Invalid XML declaration: must be first, no whitespace before <?xml. Unquoted attribute values: <item id=5> (must be id="5").

Frequently Asked Questions

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

Well-formed XML follows the XML 1.0 structural rules (correct nesting, closed tags, quoted attributes, etc.). Valid XML additionally conforms to a specific schema (DTD or XSD) that defines which elements and attributes are permitted. This tool checks well-formedness only.

Can I validate against an XML Schema (XSD)?

Not in this tool — XSD validation requires schema processing not available in browsers' built-in parsers. For XSD validation, use tools like XMLSpy, Oxygen XML, the Java JAXB validator, or the online W3C XML Validator.

Why does the validator report an error at line 1 when my XML looks correct?

A BOM (byte order mark) before the XML declaration, a whitespace character before <?xml, or an incorrect encoding declaration can all cause parsing to fail on the first line even though the visible text looks fine. Check for hidden characters.

What is CDATA in XML?

A CDATA section (<![CDATA[content]]>) wraps text that should be treated as character data, not markup. Characters like < and & inside CDATA do not need escaping. CDATA is often used for embedding HTML or script code within XML elements.

See also the XML Formatter, XML to JSON, and the JSON Formatter.