CalcCafe

XML Validator

Check whether XML is well-formed, with precise error messages. It runs entirely on your device — nothing is uploaded.

Reviewed by the CalcCafe editorial team · Last updated 1 July 2026 · How we test our tools

Example

Paste XML to check it's well-formed. Errors point at the exact problem.

How it works

The browser's XML parser reports the first well-formedness error — unclosed tags, bad nesting or invalid characters.

Good to know

The XML Validator checks whether a snippet or full document is well-formed XML — meaning it follows the basic syntax rules every XML parser depends on, such as a single root element, properly closed and correctly nested tags, quoted attribute values, and escaped special characters. It's aimed at developers, integration engineers, and anyone working with config files, RSS/Atom feeds, SVG, SOAP requests, or sitemaps who needs a quick yes/no on whether their markup will parse at all.

Reach for it when an app rejects an XML payload, an API returns a parse error, or you've hand-edited a config and want to confirm it's clean before deploying. Because it runs entirely in your browser, you can paste sensitive or proprietary XML without it ever being uploaded — useful for internal API contracts or customer data you shouldn't send to a third-party server.

To read the result: a "valid" or "well-formed" outcome means the parser walked the whole document without a structural error. An error message points to the first problem it hit — typically with a line and column — so fix that one issue and re-run, since the parser stops at the first failure and may surface a second error only after the first is resolved.

One important caveat: well-formedness is not the same as validity against a schema. This tool confirms the syntax is correct, but it does not check your XML against a DTD, XSD, or RelaxNG, so it won't tell you whether required elements are missing or values are the wrong type. A common gotcha is bare ampersands and angle brackets in text content — write &amp;, &lt;, and &gt; rather than raw &, <, or >.

Frequently asked questions

Is my data uploaded anywhere?
No — everything runs in your browser. Your code never leaves your device, so it's safe for private work and runs offline once loaded.
Is this tool free?
Yes, completely free with no sign-up and no limits.

People also ask

What is the difference between well-formed and valid XML?
Well-formed XML simply follows XML's syntax rules: one root element, properly closed and nested tags, and quoted attributes. Valid XML additionally conforms to a schema (DTD, XSD, or RelaxNG) that defines which elements, attributes, and values are allowed. This tool checks well-formedness, not schema validity.
Why does my XML say 'opening and ending tag mismatch'?
That error means a closing tag does not match the most recently opened tag, usually from a typo, a missing closing tag, or overlapping tags. XML requires strict nesting, so tags must close in the reverse order they were opened.
Can XML have more than one root element?
No. A well-formed XML document must have exactly one root (document) element that contains everything else. Two top-level elements will trigger a 'junk after document element' or extra-content error.
How do I include special characters like & and < in XML?
Replace them with entity references: use &amp; for an ampersand, &lt; for a less-than sign, and &gt; for a greater-than sign. Alternatively, wrap raw text in a CDATA section so the parser treats it as literal character data.
Does XML care about uppercase and lowercase in tag names?
Yes, XML is case-sensitive. An opening tag like <Item> must be closed with </Item>, not </item>; mismatched casing is treated as a different element and will cause a parse error.
Why is my XML declaration causing an error?
The XML declaration, such as <?xml version="1.0" encoding="UTF-8"?>, must be the very first thing in the document with no spaces, blank lines, or a byte-order mark before it. Anything preceding it makes the document not well-formed.
Is an empty document considered valid XML?
No. An empty string or whitespace-only input has no root element, which is required, so a parser reports it as not well-formed. Every XML document needs at least one element.
What are the benefits of using an XML validator?
A validator catches syntax problems before they reach a parser in production, pointing to the exact line where a tag is unclosed, nesting is wrong, or a character needs escaping. That saves time compared with guessing from a vague error in an app or API, and it lets you check a hand-edited config or feed before deploying it. This one runs in your browser, so private documents stay local.
What are the different types of XML validators?
The basic type checks well-formedness, meaning correct syntax such as one root element and properly nested, closed tags, which is what this tool does. Schema validators go further and check the document against a DTD, XML Schema (XSD), RELAX NG, or Schematron rules that define which elements, attributes, and value types are allowed. Well-formedness is required before schema validation can even begin.
What is the best XML viewer?
For simply reading a file, a web browser works well because it renders well-formed XML as a collapsible tree, and the formatter on this site gives an indented, copyable version. For editing and validation, a code editor with an XML extension is the usual choice. Validate first if the viewer refuses to load the file, since a single unclosed tag prevents display.
What are the two types of XML?
The two terms usually meant are well-formed XML and valid XML. Well-formed XML follows the basic syntax rules, such as a single root element and matched, properly nested tags, which is what this validator checks. Valid XML is well-formed and also conforms to a schema, such as a DTD or XSD, that defines which elements and attributes are permitted.

Related calculators

Sources & references

These tools follow our methodology and provide educational estimates only — verify important figures with a qualified professional.