Validate XML
Paste or upload XML to instantly validate syntax and get detailed error messages with line numbers
Paste or drop your XML and get instant syntax checking with exact line numbers and error details — no signup, no server round-trips. The browser's built-in DOMParser does the heavy lifting, catching mismatched tags, unescaped ampersands, and missing root elements in milliseconds. And everything runs in your browser. Nothing gets uploaded.
How It Works
The browser has a built-in XML parser (DOMParser) that follows the W3C spec. When you click Validate, we feed your text into that parser and check for a <parsererror> element in the result. If one exists, we extract the error message and line number so you can jump straight to the problem. No regex hacks, no partial parsing — it is the same engine browsers use to render actual XML.
Examples
Mismatched Closing Tag
You accidentally typed </naem> instead of </name>. Classic typo.
<user>
<name>Alice</naem>
<role>admin</role>
</user>
❌ Error on line 2:
Opening and ending tag mismatch: name and naem
Unescaped Ampersand in Content
Someone put "Tom & Jerry" in an XML field without escaping the ampersand. The parser chokes on it.
<show>Tom & Jerry</show>
❌ Error on line 1:
EntityRef: expecting ';'
Valid Maven POM Snippet
Quick check on a dependency block before committing. Everything looks good.
<dependency>
<groupId>org.junit</groupId>
<artifactId>junit</artifactId>
<version>5.10.1</version>
</dependency>
✅ Valid XML
Well-formed document with no errors.
Who Uses This
Debugging XML config files for Spring, Maven, or Android manifests before a build.
Checking XML exports from ETL pipelines and SOAP service responses for structural issues.
Validating hand-edited SVG files that refuse to render after manual tweaks.
Verifying DITA or DocBook XML before pushing content to a publishing pipeline.
Common Mistakes
XML treats & as the start of an entity reference. Write & for a literal ampersand, < for less-than, and so on. This catches more people than any other XML error.
<Name> and <name> are different tags in XML (unlike HTML). Opening with one and closing with the other gives a mismatch error. Pick a casing convention and stick with it.
In HTML you can get away with <div class=main>. XML won't allow it. Every attribute value needs double or single quotes: <div class="main">.
XML documents must have exactly one root element wrapping everything. Two sibling elements at the top level like <a/><b/> is not valid. Wrap them in a container tag.
Technical Details
- Processing: 100% client-side via DOMParser API
- Validation Type: Well-formedness check (not schema/DTD validation)
- File Upload: Accepts .xml, .svg, .xhtml files up to browser memory limits
- Browser Support: Chrome, Firefox, Safari, Edge (all modern browsers)
- Error Detail: Line number, column, and error description from native parser
Frequently Asked Questions
What's the difference between valid XML and well-formed XML?
Well-formed means the syntax is correct — tags match, attributes are quoted, there's one root element. Valid means it also conforms to a schema (XSD or DTD) that defines which elements and attributes are allowed. This tool checks well-formedness only. Most syntax bugs get caught at that level anyway.
Can I validate an XML file against an XSD schema here?
No. Schema validation requires a server-side parser like Xerces or lxml. Browser DOMParser doesn't support XSD or DTD validation. But if your XML isn't even well-formed, schema validation would fail anyway — so start here to catch structural errors first.
Is my XML data sent to a server?
No. Everything runs locally in your browser using JavaScript's DOMParser. Your XML stays on your machine — nothing gets uploaded. You can disconnect from the internet and the tool still works.
Can I validate SVG or XHTML with this tool?
Yes. SVG and XHTML are both XML-based formats, so this validator catches their syntax errors too. Drop in an .svg file that won't render and you'll usually find a missing namespace declaration or an unclosed path element within seconds.
Why does my XML fail here but work in a browser?
Browsers are very forgiving with HTML, auto-closing tags and ignoring errors. XML has zero tolerance — one unclosed tag or unescaped ampersand and the whole document is rejected. If your file renders in a browser, it's probably being parsed as HTML, not XML. This tool enforces strict XML rules, which is what you actually want for config files and data exchange.