Validate XML online with Calzyra's free XML Validator. Check XML syntax, find parsing errors, and identify malformed tags with clear validation feedback.
Press Validate XML or Ctrl+Enter to check the document.
Load sample data to get started
What this tool can do
Real XML Parsing
A character-by-character parser checks the document, never pattern matching
Line & Column
Every problem is reported with the exact position it occurred on
Tags Nest & Match
Mismatched, unclosed and crossed tags are each reported clearly
Attribute Checks
Unquoted, duplicate and malformed attribute syntax is caught
Entity References
Undeclared and malformed entity references are flagged
Format / Beautify
View the document indented with two spaces per nesting level
Validates On Demand
Results never go stale while you edit; Ctrl+Enter forces a check
Copy Input & Results
One click puts the XML or the verdict on your clipboard
Methodology and approach
The validator parses the document with a real XML parser and reports the first problem it finds - tag nesting, attribute syntax, undeclared entities - with the line and column it occurred on.
An XML Validator checks that a document is well-formed XML: every opening tag has a matching closing tag, the tags nest properly, attributes are quoted and appear once each, there is exactly one root element, and every entity reference such as & or € is one the document declares. A document that passes is called well-formed, which is the baseline every XML parser - and every tool that consumes XML - requires.
This tool parses the document with a real character-by-character XML parser rather than pattern matching, so it understands the constructs that decide a document's structure: a greater-than sign inside an attribute value, a nested comment marker, a CDATA section holding raw markup. The check runs entirely in your browser; nothing is uploaded.
Paste your XML into the Input XML panel on the left - a sample document is already loaded - then press Validate XML, or Ctrl+Enter. The verdict appears in the XML View panel on the right: "Valid XML" when the document parses, or the parser's message with its line and column when it does not. A summary below both panels repeats the result with the root element name and the element count on success.
Validation is on demand, not automatic: the check runs when you ask for it, and the last verdict is cleared the moment you edit the input, so a stale "Valid XML" is never shown beside a document it does not describe. The Sample dropdown and the Quick Examples below load a document and validate it in one step.
The Format / Beautify button writes an indented copy of the document into the XML View panel and leaves your input untouched - useful for reading the structure around an error. If the document does not parse, formatting falls back to validation so you still see the error with its position.
The document below is well-formed: one root element, matching tags, a quoted id attribute, and no entity references the document fails to declare. The tool reports it as valid and names the root element.
<?xml version="1.0" encoding="UTF-8"?>
<catalog>
<book id="1">
<title>XML in Practice</title>
<price>29.99</price>
</book>
</catalog>Valid XMLMismatched and unclosed tags are the most frequent: a closing tag that names a different element, or an element opened but never closed. The parser reports which tag was expected and where the problem starts, so the fix is usually visible at a glance.
Attribute problems come next: an attribute value left unquoted (id=1 is not XML), the same attribute written twice on one tag, or an attribute name where an element name was expected. The validator also rejects stray text before the root element, a second root element, and crossing tags such as <a><b></a></b>.
Entity references are checked too. The five predefined entities - <, >, &, " and ' - are always available; any other reference, such as € or ©, is an error unless the document's own document type declaration defines it. A bare ampersand that starts no reference at all is reported the same way.
The XML View below shows the verdict for a document with a mismatched closing tag - the same message the tool prints, produced by the same parser:
<catalog>
<book>
<title>Broken</book>
</catalog>Mismatched closing tag: <title> is closed by </book>. (line 3, column 18)Well-formedness and validity are two different questions. This tool answers the first: does the document parse as XML at all? XSD (XML Schema Definition) validation answers the second: does the parsed document conform to a schema that declares which elements are allowed, in what order, with which attribute names and which data types - a schema that might require every book to carry an isbn attribute of type string, for example.
Because this tool checks well-formedness only, it works on any XML document with no schema to supply, and it catches the errors that break parsers and converters first. If you need schema validation, feed the well-formed document this tool produces into an XSD-aware processor on your own stack.
Validate whenever XML moves between systems: before pasting an API response into a converter, after hand-editing a configuration file, when a feed or sitemap fails to load, or as a first step before running XPath, converting to JSON or CSV, or loading the document into the tree viewer. A well-formedness error at step one explains failures that would otherwise look like bugs in every tool after it.
For documents you author often, the Formatter and the Minifier beside this tool both parse the same way - so a document that validates here will format and minify there, and the error positions reported here match the ones they print.
Common questions about this tool