XML Formatter
Free online XML formatter and validator. Pretty-print or minify XML with clear validation errors, entirely in your browser.
Using the browser's own parser is what makes validation trustworthy
Rather than implementing a custom XML parser with its own notion of what counts as well-formed, this tool hands the input straight to the browser's built-in `DOMParser` — the exact same parser the browser itself uses when loading an XML document or an XML-based format like SVG or RSS. That means a validation error reported here reflects a genuine, standards-compliant XML parsing failure, not a quirk of some custom parsing logic — if this tool says the XML is invalid, any standard XML-consuming system would reject it too, and if it says valid, that's a real, meaningful guarantee rather than an approximation.
Why DOCTYPE and processing instructions don't survive formatting
This formatter reconstructs output starting from the parsed document element (the root node) rather than the raw document as a whole, which means anything that lives outside that root — a DOCTYPE declaration, an XML processing instruction like `<?xml-stylesheet ...?>` — isn't part of what gets serialized back out. That's a deliberate simplification to keep the formatter focused on the actual document structure (elements, attributes, text, comments) rather than every possible pre-root construct XML allows; if a DOCTYPE or processing instruction needs to survive, it has to be re-added to the output manually after formatting.