What does the XML formatter do?
It checks that a document is well-formed XML: one root element, matching tags, quoted and unique attributes, valid names, character and entity references, comments, CDATA and the XML declaration, plus Namespaces in XML (every prefix declared, at most one colon per name). Errors point to the exact line and column.
It then re-indents only element-only content. Text, mixed content, CDATA, comments, entity references and anything under xml:space="preserve" stay byte for byte, the way xmllint --format behaves, so formatting never changes the data.
How to use this tool
- Paste XML into the input. It is checked as you type.
- Pick an indent and copy the pretty-printed or minified result, or use Prettify / Minify to rewrite the input.
- Click Show in input on an error to jump to the problem.
Frequently asked questions
Does it validate against a schema or DTD?
No. It checks well-formedness and namespaces, which every XML parser requires. Validation against an XSD or DTD is a separate step.
Is it safe to format signed XML such as SAML?
Formatting only changes whitespace between elements, but XML signatures cover exact bytes after canonicalization, and some canonical forms keep that whitespace. Verify signatures on the original document, not a formatted copy.
Is my XML uploaded?
No. Parsing and formatting run entirely in your browser.