XML Formatter & Validator
Pretty-print, indent, and validate XML using your browser's real XML parser.
How to Format XML
- Paste your XML into the input box.
- The pretty-printed, indented version appears instantly below.
- If the XML is invalid, a real parser error explains exactly what's wrong.
Frequently Asked Questions
How does this tool actually validate the XML?
It uses your browser's own built-in XML parser (the same one browsers use to parse real XML documents), not a hand-written checker. If the XML is malformed, the browser's parser produces a real error describing exactly what's wrong.
Does this validate against a schema (XSD or DTD)?
No — it only checks that the XML is well-formed (properly nested tags, matched quotes, valid syntax), not that it conforms to a specific schema's rules. Schema validation requires knowing the schema being validated against, which is outside the scope of this general-purpose tool.
Are comments and CDATA sections preserved when formatting?
Yes — comments and CDATA sections are kept in the formatted output, in their original position in the document structure.
Is my XML sent anywhere?
No — parsing and formatting both happen entirely in your browser, so nothing you paste in is ever sent to a server.