XML Formatter
This XML formatter parses your XML, reports the first syntax error if it is not well-formed, and outputs it either neatly indented or minified.
About this tool
This XML formatter parses your XML, reports the first syntax error if it is not well-formed, and outputs it either neatly indented or minified.
How to use it
- Paste your XML into the input box.
- Click Format XML to indent it, or Minify to remove whitespace.
- Read the error message if the XML is not well-formed.
- Copy the output.
Good to know
- Validation uses the browser's DOMParser, which checks that XML is well-formed: matching tags, one root element and quoted attributes.
- Comments and CDATA sections are preserved in the formatted output.
- Well-formed is not the same as valid: checking against an XSD or DTD schema is not part of this tool.
- XML element and attribute names are case-sensitive.
Runs entirely in your browser — nothing you enter is uploaded or stored.
Frequently asked questions
Does this validate XML against a schema?
No. It checks that the XML is well-formed. Schema validation against XSD or DTD needs a dedicated validator.
What causes 'not well-formed' errors?
Typical causes are unclosed or mismatched tags, a missing root element, unescaped & or < characters and unquoted attribute values.
Can I format SOAP responses and RSS feeds?
Yes. Any well-formed XML, including SOAP envelopes, RSS/Atom feeds, SVG and config files, can be formatted.
Is my XML sent to a server?
No. Parsing and formatting happen in your browser.