XML Validator
Paste XML, and a schema if you have one. See every error with its line and a fix. Nothing leaves your browser.
- 0
- Lines
- 0
- Elements
- 0
- Errors
On this page
About XML Validator
Updated
What is an XML Validator?
An XML validator, or XML schema validator, checks two things. First, that the XML is well-formed: it follows the syntax rules of XML 1.0. Second, that it is valid: it follows a schema that says which elements, attributes and values are allowed. This tool does both, with XSD, DTD and RelaxNG schemas, and lists every error at once.
How to use this tool
Paste your XML in the XML tab, open a file, or drop one on the editor. The tool checks it as you type. To check it against a schema, open the Schema tab and paste the XSD, DTD or RelaxNG schema there. A file with a DOCTYPE that holds its own rules is checked against them without a Schema tab.
Each error is ringed in the editor, on the exact element, attribute or value. The Result pane gives its line and column, says what is wrong in plain words, and says how to fix it. Click an error in the list to jump to it. Errors in the schema itself are ringed in the Schema tab.
Validate XML against an XSD schema
The XSD check reads the built-in types and rules of XSD 1.0, the version almost every published schema uses: dates and numbers, lists of allowed values, patterns, lengths, ranges, required elements and attributes, and their order. When a value has a common mistake, the error shows the right form. A date written 2026-11-21 14:30 gets the answer: write 2026-11-21T14:30:00.
Schemas in several files
Real schemas are often split into parts with xs:include and xs:import. Drop all the files on the Schema tab at once. Each part goes in after a line such as <!-- file: common.xsd -->, and the main schema finds them by name. Nothing is fetched from the web: if a part is missing, the error names the file to add.
Fix and Format
Fix repairs the common slips. A bare & becomes &, and curly quotes become straight quotes. Spaces before <?xml are removed, and so are spaces around a date such as <placed> 2026-11-21 </placed> when the schema says the value is a date. A tag pair with two spellings, such as <version>...</versoin>, gets the spelling your file and schema use most. When each spelling is used once and there is no schema, check which one Fix kept. Fix keeps a repair only when the file gets better.
Format indents valid XML with 2 spaces, 4 spaces or tabs. Undo takes back Fix and Format. To indent XML without a schema check, you can also use the XML Formatter. To make XML from JSON, use JSON to XML.
Common XML errors
A bare ampersand
An & starts an entity in XML. To write the character itself, use &. Company names and URLs with query strings are the usual cause.
<name>Orders & Billing API</name><name>Orders & Billing API</name>A closing tag that does not match
Every closing tag must repeat the name of its open tag exactly. Names are case-sensitive, so a typo or a capital letter breaks the file.
<version>3.3.4</versoin><version>3.3.4</version>A date in the wrong form
xs:dateTime needs the date, a T, and the time with seconds. A time zone at the end (Z or +01:00) is allowed. xs:date takes the date alone.
<placed>2026-11-21 14:30</placed><placed>2026-11-21T14:30:00Z</placed>A number with a decimal comma
xs:decimal, xs:float and xs:double use a dot, with no thousands separator and no currency sign.
<item sku="CABLE-3M" price="7,50"/><item sku="CABLE-3M" price="7.50"/>The root does not match the schema
When an XSD has a targetNamespace, the root element must be in that namespace. Without the xmlns, the validator finds no matching element and stops at the root.
<order currency="EUR"><order xmlns="urn:example:orders" currency="EUR">XML schema validator: XSD, DTD and RelaxNG
A schema describes what a type of XML document may contain. Three schema languages are common, and this tool reads all three.
XSD (XML Schema)
XML Schema, or XSD, is the W3C schema language and the most used one. It is written in XML, has built-in data types such as xs:date, xs:decimal and xs:anyURI, and supports namespaces. Maven, SOAP and WSDL, sitemaps, e-invoices and most industry formats publish an XSD.
DTD (Document Type Definition)
A DTD is the oldest schema language, part of XML 1.0 itself. It lists the elements, the order of their children, and their attributes. It has no data types and no namespace support. A DTD can sit inside the file, in the <!DOCTYPE ...[ ]> at the top, or in its own .dtd file.
RelaxNG
RELAX NG is a simpler schema language from OASIS and ISO. Its patterns read close to the document they describe, and it can use the XSD data types. DocBook, ODF (OpenDocument) and EPUB use it. This tool reads its XML syntax (.rng).
How the check runs
Syntax errors are found first by the tool's own strict reader, which gives each one plain words and an exact place. Then libxml2, the library behind xmllint, finds every other error and checks the schema. It runs as WebAssembly in your browser, and large files are checked in the background so the page stays free to use.
Other XML schema resources
- W3C XML 1.0 SpecificationThe rules for well-formed XML, and for DTDs.
- XML Schema Part 0: PrimerThe W3C's readable introduction to XSD, with examples.
- XML Schema Part 2: DatatypesEvery built-in XSD type, such as dateTime and decimal, and the forms they accept.
- RELAX NG TutorialThe official tutorial for RELAX NG schemas.
- libxml2The XML library behind xmllint, used by this tool to check schemas.
- libxml2-wasmlibxml2 built as WebAssembly, so it runs in the browser.
XML Validator FAQ
How do I check XML syntax?
Paste the XML in the editor. The tool checks it as you type and lists every syntax error at once: tags closed in the wrong order, a bare &, an attribute without quotes, text outside the root. Each error has its line and column, a ring in the editor, and a sentence on how to fix it. A file with no errors gets Valid XML and a blue square.
How do I validate XML against an XSD?
Paste the XML in the XML tab and the XSD in the Schema tab. The tool checks the XML against the schema as you type. Each mismatch is ringed on the exact element, attribute or value, with the rule it breaks: a date without its T, a value that is not on the list, a missing required attribute.
What is the difference between well-formed and valid XML?
Well-formed XML follows the syntax rules of XML: one root element, every tag closed in the right order, quoted attribute values, & and < written as entities. Valid XML is well-formed and also follows a schema (an XSD, a DTD or a RelaxNG schema) that says which elements, attributes and values are allowed. This tool checks both: syntax always, and the schema when one is in the Schema tab or in the DOCTYPE.
Can I use a schema that is split into several files?
Yes. Drop all the .xsd files on the Schema tab at once, or pick them together with File. They go into the tab one after the other, each after a line such as <!-- file:. The order rarely matters: the main schema is the file at the top, the one no other file includes, and its xs: and xs: find the others by file name. A missing file gives an error that names it.
Does the tool fetch the schema from xsi:schemaLocation?
No. Nothing leaves your browser, so the tool never downloads a schema. When a file names its schema with xsi: or xsi:, the Result pane shows the address. Download that file once and drop it in the Schema tab.
Is my XML uploaded?
No. The check runs in your browser with libxml2, the same library behind xmllint, built for the web. Your XML and your schemas stay on your computer. A few seconds after the page has loaded, the checker is in your browser, and you can go offline and still validate.
Is XML outdated?
No. JSON took over many web APIs, but XML is still the format of Maven and Android builds, Office documents, SVG, RSS and Atom feeds, sitemaps, SOAP services, e-invoices (UBL, Peppol) and most banking and government data exchange. Many of them, such as Maven, sitemaps, SOAP and UBL, publish an XSD schema, which is why validation still matters.
How do I test an XML file?
Open it with File, drop it on the editor, or paste it. First fix the syntax errors, then add its schema in the Schema tab to test the content. For files you check often, run the same test in a build step with xmllint --noout --schema schema., which uses the same library as this page.