XML Validator
Paste an XML document and instantly validate its syntax using your browser's native XML parser. If the XML is valid, you can view it formatted with clean indentation; if not, you'll see exactly what's wrong.
How it works
- Paste or type your XML into the input panel.
- Your browser parses the document with its native XML parser (DOMParser).
- If the syntax is correct, a formatted, indented version of the XML is displayed.
- If there's a syntax error, you'll see the message reported by the browser's own parser.
- Copy the formatted result or download it as an .xml file.
Use cases
- Check that an XML config file has no errors before using it.
- Debug XML responses from APIs or SOAP services.
- Format minified or machine-generated XML to make it readable.
- Review XML feeds (RSS, sitemaps) before publishing them.
Use cases
- Check that an XML config file has no errors before using it.
- Debug XML responses from APIs or SOAP services.
- Format minified or machine-generated XML to make it readable.
- Review XML feeds (RSS, sitemaps) before publishing them.
Common mistakes
- Leaving a tag unclosed or closing tags in the wrong order.Unlike HTML, XML requires every tag to be explicitly closed and in order. The validator points to exactly where the parser found the problem.
- Having more than one root element in the document.A valid XML document must have a single root element wrapping everything else.
- Using special characters like & without escaping them.Replace & with &, < with <, and so on, or the parser will interpret it as the start of an invalid entity.
Frequently asked questions
No. Validation happens entirely in your browser using DOMParser, JavaScript's native XML parsing API. Your XML never leaves your device.
No. It only checks that the XML is well-formed (syntactically correct): properly closed tags, a single root element, correctly written attributes, and so on. It doesn't check compliance with a specific XSD, DTD, or RelaxNG schema.
The tool shows the error message reported by the browser's XML parser, indicating where in the document the problem was found.
Yes. If the XML is valid, the tool always shows a formatted, indented version, regardless of whether the original XML was on a single line or already had line breaks.
Alternatives
Editors like VS Code with XML extensions validate as you type. This tool is useful for a quick one-off check with nothing to install, for example before pasting XML into a ticket or an email.