XML Validator
Check XML well-formedness with exact error line/column.
Related Tools
Documentation
What is XML Validator?
XML Validator checks whether a document is well-formed XML and reports a pass/fail result — it doesn't parse the document into a viewable structure or convert it, just tells you yes or no (and why not).
How it works
Clicking Validate (or pressing Cmd/Ctrl+Enter) runs the input through the browser's native DOMParser with MIME type application/xml. The parser inserts a parsererror element into the resulting document when the XML is malformed; the tool checks for that element and, if found, reports its text as the failure message, attempting to pull a line number out of it with a regex (browsers don't expose a consistent line/column API for XML errors, so this is best-effort). If no error node is present, the document is well-formed and the tool reports success along with the root element's tag name.
Features
- Instant well-formedness check via the native DOMParser
- Reports the root element's tag name on success
- Best-effort line highlighting on failure, when the browser's error text includes one
- Character count of the current input
- Load an .xml file directly from disk
Example
Input: <root><name>DevFormats</name><valid>true</valid></root>
Output:
✓ Well-formed XML — root element <root>
An unclosed tag like <root><name>DevFormats</root> instead reports a failure with the browser's raw parser error text.
Common errors
"Well-formed" only means the structural rules of XML are satisfied: matched and properly nested tags, quoted attribute values, and a single root element. This tool does not check a document against an XSD or DTD schema — a well-formed document can still be semantically wrong for a given schema (missing required elements, wrong types, etc.), which needs a separate, schema-aware validator.
Best practices
Run this as a fast first check before feeding XML into a stricter pipeline — well-formedness failures are cheap to catch here and much more informative than a downstream parser crashing deep inside a build or ingestion process.
Frequently Asked Questions
What does "well-formed" mean for XML?▾
It means every tag is properly opened, closed, and nested, attributes are quoted, and there's exactly one root element — the baseline structural rules every XML document must follow.
Does this check against a schema (XSD/DTD)?▾
No — this checks well-formedness only. Validating against a specific schema is a separate, much narrower concern than general syntax correctness.
Why don't I get a line number for the error?▾
Browsers' native XML parsers don't expose a consistent line/column API — the raw parser error message is shown instead, which often mentions the nearby content.
Is my XML uploaded anywhere?▾
No — validation runs entirely in your browser via the native DOMParser.