How do I validate XML online?
Paste your XML into the input box, or open or drop a file. Then press Validate, or Ctrl+Enter (⌘+Enter on a Mac). When the XML is well-formed, the Result box says so and shows its lines, elements, size, encoding and root element.
When it isn't, you get the line and column of the first error, a plain-English explanation and the lines around it. Go to error selects that spot in the input, so you can fix it and check again.
Well-formed XML vs valid XML
Well-formed XML follows the syntax rules of XML 1.0: exactly one root element, an end tag for every start tag, elements closed in the reverse order they were opened, attribute values in quotes, and & and < written as & and < in text. One broken rule is enough to stop a feed or a sitemap from loading.
Valid XML is well-formed and also follows a schema, a DTD or an XSD file that says which elements and attributes are allowed. This validator checks well-formedness, the test every parser applies first.
Common XML syntax errors and how to fix them
Tags closed in the wrong order: <b><i>Hi</b></i> becomes <b><i>Hi</i></b>. A bare ampersand: AT&T becomes AT&T. An attribute without quotes: id=3 becomes id="3". A space or a blank line before <?xml, which must come first.
Other usual causes are a typo in a closing tag, a tag never closed, two root elements and an invisible control character copied from another program. The validator names each of them and suggests a fix. Validate again after each fix to find the next error.
Does this XML validator check XSD or DTD schemas?
No. A schema check needs the schema file and a validating parser. This tool reads the DOCTYPE and its internal declarations to check their syntax, but never downloads an external DTD. To validate against an XSD, run xmllint --noout --schema schema.xsd file.xml in a terminal.
Does this XML validator upload my file?
No. The check runs in this browser tab, and the security rules of this page stop it from sending anything. Nothing is saved. The XML formatter can then indent or minify the file. For a sitemap, use the sitemap checker; for JSON, the XML to JSON converter; for XSLT, the XSLT tester; for XPath, the XPath tester.
The same five errors in Chrome, Python and this validator
On 30 November 2026 I pasted five broken snippets into Chrome 158 (opened as a file, with no extension installed), Python 3.14 (xml.etree.ElementTree) and this validator, and copied each first message. All five are on line 1.
| Snippet | Chrome 158 | Python 3.14 | This validator |
|---|---|---|---|
<b><i>Hi</b></i> | Column 13: Opening and ending tag mismatch: i line 1 and b | mismatched tag: column 10 | Column 9: the closing tag </b> doesn’t match <i> |
<c>AT&T</c> | Column 8: EntityRef: expecting ';' | not well-formed (invalid token): column 7 | Column 6: the reference &T is missing its closing ; |
<p id=3/> | Column 7: AttValue: " or ' expected | not well-formed (invalid token): column 6 | Column 7: the value of id must be in quotes |
A space, then <?xml version="1.0"?><a/> | Column 7: XML declaration allowed only at the start of the document | XML or text declaration not at start of entity: column 1 | Column 2: the XML declaration must be at the very start of the file |
<a/><b/> | Column 5: Extra content at the end of the document | junk after document element: column 4 | Column 5: a second root element <b> starts here |
The column numbers disagree, and that is normal. Python counts columns from 0, Chrome and this validator from 1. Chrome often points at the character where it gave up, one or more places after the mistake. This validator points at the first character of the faulty tag, reference or value, which is where you put the cursor to fix it. When two tools disagree, look a few characters before the column they report. Scripts in a page get other wording: in the same Chrome 158, DOMParser called the first snippet an “Unexpected closing tag”, at column 12.
Questions
Why does another program reject XML that passes here?
It probably checks more than syntax, such as a schema or required elements. This tool checks well-formedness, not a DTD or XSD. See the schema or the documentation of that program.
How can I check XML syntax without a website?
In a terminal, xmllint --noout file.xml prints nothing when the file is well-formed, and the errors it finds, with their line numbers, when it is not. Most code editors do it too with an XML extension.
Is there a file size limit?
Yes, 20 MB for an opened file or for pasted text. The check runs in the background, so the page stays responsive.
Why does it show only one error?
XML parsers stop at the first error, because the rest of the file can no longer be read reliably. Fix it, validate again, and the next error shows up if there is one.
Can it fix my XML?
No. It points to the first error and explains it, and you decide how to fix it. An automatic fix could silently change your data.
Can I check XML directly in Chrome?
When Chrome opens XML that is not well-formed, it shows an error with a line and column at the top of the page. XMLNest, an extension available on the Chrome Web Store, shows XML files as a readable tree and points to the error when a file is broken.