Text Tools
XML Validator
Validate XML syntax and check for well-formedness.
Status
Invalid
DOMParser is not defined
Paste any XML document. The validator checks for syntax errors and well-formedness. Valid XML documents will display element count.
Text Tools
Validate XML syntax and check for well-formedness.
Status
Invalid
DOMParser is not defined
Paste any XML document. The validator checks for syntax errors and well-formedness. Valid XML documents will display element count.
XML validation is the process of checking whether an XML document conforms to its syntactic rules: every opening tag must have a matching closing tag, tags must be properly nested, attribute values must be quoted, and special characters must be escaped. A validator parses your XML and reports whether it is "well-formed" (structurally correct) and optionally whether it matches an expected schema (like XSD).
The validator reads your XML text and applies parsing rules: it checks that the declaration (if present) is valid, confirms each opening tag has a closing tag, verifies nesting order, validates attribute syntax, and scans for unescaped special characters. When an error is found, it stops and reports the line number, column position, and description of the problem so you can fix it.
| Input | Result | Notes |
|---|---|---|
| <root><item>Valid</item></root> | Valid XML. No errors found. | Properly opened/closed tags in correct nesting order. |
| <root><item>Unclosed tag</root> | Error: Line 1, Column 22. Closing tag 'root' does not match opening tag 'item'. | Tag mismatch—'item' opens but 'root' closes first. |
| <root><item name="Test">Content</item></root> | Valid XML. No errors found. | Attributes must be quoted; this example is correct. |
Well-formed XML follows all syntax rules (proper nesting, closed tags, escaped characters). Valid XML also matches a schema (XSD) or DTD. This tool checks well-formedness; schema validation requires a separate schema file.
This validator checks basic well-formedness. To validate against an XSD schema, you'll need a schema-aware tool or server-side parser that can load and compare your schema alongside your XML.
Characters like <, >, &, ", and ' must be escaped inside text or attributes: use < > & " ' or wrap text in CDATA sections like <![CDATA[text]]>.
Yes. Namespaces (like <root xmlns="http://example.com">) are valid as long as prefixes are declared and used consistently throughout.
XML without a declaration (<?xml version="1.0"?> on line 1) is still valid if the root element is present and well-formed, but some parsers expect the declaration.
This tool works with pasted text. For files, paste the XML content directly or use browser file APIs if the tool supports it. Check for a file upload button on the page.