XML Validator
Check that XML is well-formed and find errors by line and column.
Runs in your browser. Nothing you type is uploaded.
How to validate XML
Paste your XML and press Validate. If the document is well-formed you see a summary: the root element, how many elements and attributes it has, and how deeply it is nested. If not, you get the first problem found with its line and column, which is also selected in the input box so you can fix it and check again.
What "well-formed" means
- There is exactly one root element, and every start tag has a matching end tag in the right order.
- Attribute values are in quotes, and no element has the same attribute twice.
<and&in text are written as<and&(or inside a CDATA section).- Comments do not contain
--, and the XML declaration, if present, is the very first thing in the file.
Well-formed or valid?
The terms differ. Well-formed means the syntax is correct. Valid means the document also follows a schema or DTD that says which elements and attributes are allowed. This tool checks well-formedness, which is the first thing any XML parser requires.
FAQ
Does it validate against a schema or DTD?
No. It checks that the XML is well-formed, meaning the syntax is correct. It does not check the document against an XSD schema or DTD, and it does not parse the contents of a DOCTYPE or check that namespace prefixes are declared.
Why does my file work in one tool but not here?
Some tools are forgiving about small mistakes such as unescaped ampersands. A strict parser, and most programming languages' XML libraries, will reject them, so it is worth fixing them.
Is my XML uploaded anywhere?
No. The check runs in your browser, so your data stays on your device.
More XML tools
- XML formatter: Format, minify and validate XML in one place.
- XML beautifier: Pretty print XML with 2 spaces, 4 spaces or tabs.
- XML minifier: Strip the whitespace between tags to make XML as small as possible.
- XML sitemap generator: Turn a list of URLs into a sitemap.xml file for search engines.