XML Formatter / Validator

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

Common use cases

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.