TOOLS WORLD logoTOOLS WORLD

XML Validator

Check XML documents for well-formedness and get precise error locations with clear explanations. Paste or upload XML and fix issues faster.

What is an XML validator?

An XML validator checks whether a document is well-formed — syntactically correct according to the XML specification. XML powers RSS feeds, SOAP services, SVG graphics, Android layouts, Maven POM files, SOAP envelopes, and countless enterprise integration formats. Unlike JSON, XML uses opening and closing tags, attributes, and optional namespaces, which creates more ways for a document to break.

This validator parses your document in the browser and reports either a success confirmation or a failure with the parser's message and line number. That turns cryptic production errors into an actionable fix: go to line 47, close the tag, validate again.

How to use the XML validator

  1. Paste your XML into the text area — a config snippet, an RSS feed, an SVG fragment, or a SOAP envelope.
  2. Click Validate XML. Results appear above the button.
  3. If valid, a green banner confirms the document is well-formed XML.
  4. If invalid, a red banner shows the error message and line number. Fix the issue at that location and validate again.

Common XML errors

Unclosed or mismatched tags

Every <element> must have a matching </element>, or use self-closing syntax like <element />. Nesting must be correct: inner tags close before outer tags.

Illegal characters and unescaped entities

Ampersands and less-than signs inside text content must be escaped as &amp; and &lt;. Attribute values must be enclosed in single or double quotes.

Multiple root elements

A well-formed XML document has exactly one root element wrapping everything else. Sibling roots at the top level are not allowed unless using a multi-document format with explicit separators.

Validation vs. formatting

Validation (this tool) confirms the document parses correctly. Formatting — see the XML Formatter — rewrites well-formed XML with consistent indentation for readability. Always validate first; formatting a broken document will fail for the same reason parsing does.

For JSON-based configs, use the JSON Validator. For YAML, use the YAML Validator.

Practical tips

  • Validate XML config files before deployment — a malformed file can prevent an application from starting entirely.
  • When debugging RSS or Atom feeds, validate the raw XML before checking feed-specific rules.
  • Use the XML Formatter after validation to make complex documents readable for code review.
  • For HTML markup (which is not always well-formed XML), consider the HTML Formatter instead.

Frequently asked questions

What does it mean for XML to be well-formed?
Well-formed XML follows the basic syntax rules of the XML specification: exactly one root element, every start tag has a matching end tag (or is self-closing), attributes are quoted, entities are properly escaped, and the document is properly nested. Well-formedness is a prerequisite for any further processing.
Does this validate against an XML Schema or DTD?
No. This tool checks well-formedness — syntactic correctness — not semantic validity against a schema. Schema validation is a separate step that confirms the document matches a predefined structure.
How is XML validation different from JSON validation?
XML is a markup language with tags, attributes, and namespaces. JSON is a data format with objects and arrays. XML errors often involve unclosed tags, mismatched nesting, or illegal characters in element names. JSON errors typically involve quotes, commas, and braces.
Is my XML sent to a server?
No. Validation runs entirely in your browser. Documents containing credentials, internal URLs, or personal data are never uploaded.
Can the validator find multiple errors at once?
It reports the first error encountered, because XML parsing stops at the first violation. Fix that error, validate again, and repeat until the document passes.
What about XML namespaces?
The validator checks well-formedness, which includes namespace declaration syntax. It does not verify that namespace prefixes resolve to declared URIs in a semantic sense — only that the markup is syntactically legal.

Related tools

More free tools you might find useful alongside the XML Validator.