XML Validator & Formatter
About XML Validator / Formatter
XML Validator / Formatter verifies that an XML document is well-formed before rebuilding it with consistent indentation and empty-element style.
How it works
Strict well-formedness validation
Opening and closing tags, attribute syntax, quotes, entity references and document structure are checked first. Failures include a source line, column and line context.
Order-preserving formatting
The formatter preserves element order, attributes, XML declarations, comments and CDATA sections while applying two- or four-space indentation.
Safe entity behavior
Entity expansion is disabled during parsing and formatting, and the tool never fetches external DTDs or resources.
Frequently asked questions
Does this validate against an XSD or DTD?
No. It checks XML well-formedness, not application-specific schemas or external document type definitions.
Are comments and CDATA preserved?
Yes. Their content and relative order are retained, while surrounding indentation is normalized.
Can it expand external entities?
No. External resources are never loaded and entity processing is disabled for safer local formatting.
Sources & last verified
The behaviour of this tool and the claims on this page were checked against the specifications below on . Everything 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 it will be re-verified.