Skip to main content
1

XML Validator

Paste XML to check well-formedness, see a parsed structure tree, and spot errors with exact line numbers. Pretty-print messy XML with one click.

More options
Was this tool helpful?
Send output to:
Advertisement

How to use XML Validator

  1. Paste your XML into the input textarea.
  2. Click Validate XML to check well-formedness.
  3. View the pass/fail status, element count, and structure tree.
  4. Optionally click Pretty-print to reformat messy XML.

What is XML Validator?

An XML validator checks whether your XML document is well-formed — that tags are properly nested, attributes are quoted, and the structure follows XML syntax rules. This tool uses your browser's built-in XML parser (DOMParser), so validation is instant and your data never leaves your device.

Beyond the pass/fail check, you get a visual structure tree showing every element, its attributes, and text content — helpful for understanding the shape of complex XML. If the document has errors, the parser tells you the exact line number where the problem occurs. The Pretty-print button reformats messy, minified, or one-line XML into indented, readable form.

Advertisement

FAQ

What does 'well-formed' mean?
Well-formed XML follows basic syntax rules: all tags are closed, nested correctly, attributes are quoted, and there is exactly one root element. It does NOT validate against a schema like DTD or XSD.
Does this validate against a DTD or XSD schema?
No — this tool checks well-formedness only, not schema validity. For DTD/XSD validation you need a dedicated XML validator tool or IDE.
Can it handle large XML files?
DOMParser can handle XML up to several megabytes. Very large files may be slow to parse in the browser — consider using a desktop XML editor for files over 10 MB.
What does Pretty-print do?
It re-indents the entire XML document with consistent spacing, making it easy to read. It also normalizes self-closing tags and re-adds the XML declaration if missing.

Related tools

Author

MW
Marcus Webb"The DevTool Craftsman"

Full-Stack Developer & Tools Architect

Marcus has been writing code since the dial-up era. He's contributed to open-source developer tools and built CI/CD pipelines for startups.

Advertisement