About the XML Formatter / Validator
XML remains widely used for SOAP APIs, configuration files, RSS/Atom feeds, and legacy enterprise systems — and like JSON, it's often transmitted minified or generated without any indentation at all.
This tool pretty-prints XML with consistent indentation for readability, or minifies it to remove unnecessary whitespace, while flagging malformed markup along the way.
How it works
- Paste your XML document or fragment into the input box.
- Click Format to indent it with two spaces per nesting level, or Minify to collapse it to a single compact line.
- Any structural errors (like unclosed tags) are reported so you can locate and fix the issue.
Common use cases
- Debugging a SOAP request: Formatting a raw SOAP envelope captured from a network trace so its nested namespaces and elements are readable.
- Reviewing an RSS feed: Pretty-printing a minified RSS/Atom XML feed to check that entries and metadata are structured as expected.
- Shrinking config files: Minifying a formatted XML configuration before storing it somewhere space-constrained, like a database column.
Frequently asked questions
What counts as invalid XML?
Common issues include unclosed or mismatched tags, unescaped special characters like a bare `&` or `<` inside text content, and multiple root elements — XML, unlike HTML, requires exactly one root element and strict tag matching.
Does this tool validate against a schema (XSD/DTD)?
No — it checks that the XML is well-formed (correct syntax and structure), not that it conforms to a specific schema. Schema validation requires the actual XSD or DTD definition, which is a separate step.
Will formatting change my content, like whitespace inside a tag?
The collapseContent option keeps text content on a single line where practical rather than aggressively reformatting it, so meaningful whitespace inside elements is preserved.
Can I format XML with namespaces?
Yes — namespaced elements and attributes (like `xmlns:soap=`) are formatted the same as any other XML; namespaces don't require special handling for indentation.
This tool runs entirely in your browser — nothing you enter is sent to a server. Read more in the Privacy Policy, or browse the full list of tools.