XML Validator
Validate XML syntax online and instantly detect errors with line numbers
Input XML
Validation Result
What is XML Validator?
Need to know whether your XML will parse? Paste it here and the validator checks it as you type. If something is wrong, you get the parser's message with the line and column; if it is fine, you get a short summary of the document: root element, element and attribute counts, depth and namespaces.
What it checks is well-formedness as defined by the W3C XML specification: every tag closed and properly nested, attribute values quoted, a single root element, no bare & or < in text. It does not check your document against an XSD or DTD. MDN's XML introduction is a good primer on the rules.
Everything runs in your browser; your XML never leaves your computer.
How to Use the XML Validator
Follow these steps to validate your XML. Each step uses the actual buttons and panels on this page.
Paste, Upload, or Load Sample
Paste XML into the left Input XML panel, or click Upload to load a .xml file. Click Sample to load example telecomm subscriber data. Example:
<subscribers><subscriber><subscriberId>SUB-1001</subscriberId><plan>Unlimited 5G</plan><dataUsage>45.2</dataUsage></subscriber></subscribers>Use Clear to start fresh. The validator checks your XML as you type.
View Validation Result
The right Validation Result panel shows VALID or INVALID. Invalid XML shows the parser's error message, which includes the line and column where it gave up. Valid XML shows a document summary.
Fix and Revalidate
If invalid, use the error messages to fix missing closing tags, unclosed elements, or invalid characters. The validator updates in real-time as you edit. All processing runs in your browser – your XML never leaves your computer.
When You'd Actually Use This
API Development
Check XML responses from SOAP services or REST APIs before you write parsing code, so you know whether a failure is your code or a broken payload.
Config File Checks
Before deploying, validate your XML configuration files. One syntax error can break your entire application. Catch it early with the validator.
Learning XML
New to XML? Use the validator to check your work. Practice writing XML and see if it's valid before using it in your projects.
Debugging
Getting parsing errors in your code? Validate the XML first. Detailed error messages help you find the exact problem faster than trial and error.
Common Questions
Is my XML uploaded?
No. Validation happens in your browser with its built-in XML parser; your XML never leaves your computer.
What makes XML invalid?
The usual suspects: a missing or misspelled closing tag, elements closed in the wrong order, an unquoted attribute value, a bare & that should be &, text or a second element after the root closes, or any content at all (a blank line counts) ahead of the <?xml ...?> declaration. Leading whitespace is trimmed here, so that last one will not trip you up on this page.
Does it validate against an XML Schema (XSD)?
No. It checks well-formedness only. To validate against an XSD, use xmllint --schema from libxml2 or your language's schema validator.
Which parser does it use?
Your browser's own XML parser (the one behind DOMParser), which implements XML 1.0. The exact wording of error messages differs between Chrome, Firefox and Safari.
Can I validate large files?
Up to 10 MB. Files of a few MB validate in a moment; for bigger ones use xmllint --noout on the command line.
Can it fix my XML?
No, it only reports the problem. The XML Fixer can try to repair broken XML for you.
Other XML Tools You Might Need
Validation is just one step. Here are other tools that work well together: