WebToolsPlanet
Converter Tools

XML Validator

Paste XML and instantly see if it's well-formed. Errors show the exact line and column. Valid XML displays the root element name, child count, total elements, and byte size.

Last updated: May 21, 2026

Client-Side Processing
Input Data Stays on Device
Instant Local Execution

Find this tool useful? Support the project to keep it free!

Buy me a coffee

What is XML Validator?

XML (eXtensible Markup Language) is strict about its syntax — every opening tag must have a matching closing tag, attributes must be quoted, special characters must be escaped, and there can only be one root element. A document that follows these rules is called "well-formed". Parsers reject any XML that is not well-formed with a parse error.

This validator uses the browser's built-in XML parser (DOMParser) to check your XML. If parsing fails, the parser reports a parsererror element with the problem description and location. The validator extracts the line and column number so you can jump directly to the issue. For valid XML, it displays the root element tag name, the number of direct children, the total element count in the entire document, and the byte size.

How to Use XML Validator

1

Paste XML into the input area or click "Valid Sample" or "Invalid Sample"

2

The validator runs instantly

3

A green badge means the XML is well-formed; red means invalid

4

If invalid, the exact line and column of the error is shown

5

Fix the issue and re-validate

Common Use Cases

  • Developers validating XML API request or response payloads before processing.
  • Engineers checking XML configuration files before deployment.
  • Teams validating SOAP envelopes before sending to web services.
  • Data engineers verifying XML data files before importing into databases.
  • Developers debugging XML parse errors from application logs.
  • Architects validating XML schemas and instance documents during design.

Example Input and Output

An XML document with a missing closing tag fails validation with the exact error location.

Invalid XML
<products>
  <product>
    <name>Widget A</name>
    <price>9.99
  </product>
</products>
Validation result
✗ Invalid XML
Error at line 5: expected </price> closing tag

Fix: add </price> after the value 9.99

Privacy

All validation runs in your browser via DOMParser. No data is uploaded to any server.

HTML vs XML parsing

HTML is not XML — browsers parse HTML leniently and fix errors silently. This validator uses strict XML parsing (application/xml), not HTML parsing, so valid HTML may fail here if it uses HTML-specific features like void elements without self-closing slashes.

Frequently Asked Questions

What is the difference between well-formed and valid XML?
Well-formed XML follows the basic XML syntax rules: matched tags, quoted attributes, single root, proper escaping. Valid XML is well-formed AND matches a specific schema (DTD or XML Schema). This tool checks well-formedness only, not schema validity.
What are the most common XML syntax errors?
The most frequent mistakes are: (1) Unclosed tags — every <tag> needs a </tag> or <tag/>. (2) Unescaped special characters — use &amp; for &, &lt; for <, &gt; for >, &quot; for ", &apos; for '. (3) Multiple root elements — XML must have exactly one root. (4) Mismatched tag names — tags are case-sensitive.
Does this validate XML Schema or DTD?
No. This tool validates that the XML is syntactically well-formed. Schema validation (checking that elements match a defined structure) requires a schema file (XSD or DTD) and a schema-aware validator.
Is my XML sent to a server?
No. All validation runs in your browser using the built-in DOMParser. Your XML never leaves your device.