XML validator and formatter
About XML Validator / Formatter
The XML validator and formatter checks that a document is well-formed, then rewrites it with consistent indentation and empty element style.
How it works
Well-formedness check
Opening and closing tags, attribute syntax, quotes, entity references and document structure are checked first. Errors show the line, column and surrounding source.
Order-preserving formatting
Element order, attributes, the XML declaration, comments and CDATA sections are kept. Indentation is set to two or four spaces.
Safe entity handling
Entity expansion is off during parsing and formatting. The tool never fetches external DTDs or other resources.
Frequently asked questions
Does this validate against an XSD or DTD?
No. It checks that the XML is well-formed. It does not check it against a schema or document type definition.
Are comments and CDATA preserved?
Yes. Their content and position are kept. Only the indentation around them changes.
Can it expand external entities?
No. Entity processing is off and external resources are never loaded.
Sources & last verified
We checked this tool's behavior and the claims on this page against the specifications below on . The tool runs in your browser, so the output you see is exactly what the engine produced.
Found a wrong result or an outdated claim? Report an error and we will check it again.