XML Formatter
Pretty-print and validate XML. Choose your indent and we report any parse errors.
Output appears here
What is an XML Formatter?
An XML formatter takes minified or poorly indented XML and adds consistent indentation and line breaks so the structure is easy to read. It also validates the XML for well-formedness — unclosed tags, mismatched tags, and illegal characters are flagged immediately.
This tool formats and validates XML instantly in your browser. It supports SVG, SOAP envelopes, and all other valid XML documents.
How to format XML online
- Paste your raw or minified XML into the Input box.
- The formatted output appears instantly in the Output panel.
- If there is an error, the status badge shows the problem and its location.
- Copy or download the formatted XML.
Frequently Asked Questions
What is the difference between well-formed and valid XML?
Well-formed XML follows the basic syntax rules — every tag is properly closed, attributes are quoted, and there is exactly one root element. Valid XML also conforms to a DTD or XML Schema. This tool checks for well-formedness.
Can I use this tool to format SVG files?
Yes. SVG is XML-based, so pasting an SVG into this tool will format and validate it correctly.
Does the tool support XML namespaces?
Yes. Namespaced tags such as ns:element with xmlns declarations are handled correctly.
Why is my XML showing an error?
Common XML errors include: unclosed tags, mismatched tag names, unescaped special characters like < and & inside text content, and missing quotes around attribute values.