XML Validator: Check Well-Formedness Using Your Browser's Own Parser
An unescaped ampersand, a missing closing tag, or two root elements are all mistakes that break an XML document — and the error messages from different tools can be cryptic. This validator uses the same strict XML parser your browser relies on to render RSS feeds, SVGs, and XHTML, so the errors you see here match what actually breaks XML parsing in the wild.
Well-formedness is a syntax check — it doesn't validate against a schema or DTD.
The Five Core Well-Formedness Rules
An XML document is well-formed if: it has exactly one root element, every tag is properly closed and nested (no overlapping like ), attribute values are quoted, and the five predefined entities (&, <, >, ", ') are used instead of raw &, <, >, ", ' where required.
Well-Formed vs. Schema-Valid
These are two different levels of correctness. Well-formed is a universal syntax requirement — any XML parser needs this just to build a document tree at all. Schema-valid means the document additionally matches a specific XSD or DTD that defines which elements are allowed, in what order, with what attributes — that's a separate, stricter check this tool doesn't perform.
Common Causes of 'Not Well-Formed' Errors
The most frequent real-world causes are an unescaped '&' in text content (very common when embedding URLs with query parameters), a '<' character that wasn't meant to start a tag, and mismatched or overlapping tags from a copy-paste edit gone wrong.
Practical Examples
Catching an Unescaped Ampersand
A very common real-world mistake.
- 1.Input:
https://x.com?a=1&b=2 - 2.Error: not well-formed (invalid token)
- 3.Fix:
https://x.com?a=1&b=2
Catching a Missing Closing Tag
An unclosed element.
- 1.
1984 - 2.Error: mismatched tag
- 3.Fix:
1984
What Gets Checked
- Matching open/close tags
- Proper nesting (no overlapping tags)
- Exactly one root element
- Quoted attribute values
- Escaped special characters in text content
Good Use Cases
- Debugging a broken RSS/Atom feed
- Validating an SVG file before embedding it
- Checking hand-edited config XML (like pom.xml or web.xml)
- Confirming API XML responses are well-formed before parsing them in code
Frequently Asked Questions
What does 'well-formed' mean for XML?
It means the document follows XML's basic syntax rules: every opening tag has a matching closing tag, tags are properly nested (no overlapping), there's exactly one root element, and attribute values are quoted. It does not mean the document matches a particular schema.
What's the difference between well-formed and valid XML?
Well-formed is about syntax — any XML document must be well-formed to be parsed at all. Valid means the document additionally conforms to a specific DTD or XML Schema (defining which elements and attributes are allowed where) — this tool checks well-formedness only, not schema validation.
What XML parser does this use?
The browser's built-in DOMParser with application/xml mode, the same strict XML parser engine used internally by browsers — so the same errors a browser would report when loading a broken XML/RSS/SVG file show up here.
Why do I get an error even though the tags all look matched?
Common causes that are easy to miss visually: an unescaped '&' (must be &), a '<' inside text content (must be <), an unquoted attribute value, or more than one root element.
Does this validate against an XSD schema?
No — schema validation checks a document against a specific structure definition (which elements/attributes are allowed, data types, cardinality). This tool checks universal XML syntax rules that apply regardless of schema.
Is my XML sent anywhere?
No, parsing happens entirely in your browser via the native DOMParser API — nothing is uploaded.