Clean Indentation
Nested elements are indented consistently, with 2 spaces, 4 spaces or tabs.
Format, indent and validate XML in your browser. Spot well-formedness errors with line and column details, or minify XML into a single line.
Handles attributes, namespaces, comments, CDATA and processing instructions, and keeps your XML declaration.
XML is a structured text format used in feeds, sitemaps, configuration files, SOAP services and many data exchanges. An XML formatter adds consistent indentation and line breaks so the nesting is easy to follow.
Because it uses the browser's own XML parser, it also tells you whether your XML is well-formed — and where it is not.
Nested elements are indented consistently, with 2 spaces, 4 spaces or tabs.
Mismatched or unclosed tags are reported with a line and column number.
Remove insignificant whitespace to create a compact single-line version.
Namespaces, attributes, comments, CDATA sections and the XML declaration are preserved.
Copy the result or save it as an .xml file.
Everything runs locally in your browser.
Paste XML into the input box.
Pick 2 spaces, 4 spaces or a tab.
See clean, nested XML — or an error with its location.
Copy the result or download an .xml file.
Quick answers about using the MoSanKit XML Formatter.
It checks that the XML is well-formed (properly nested and closed). It does not validate against an XSD or DTD schema.
Only whitespace between elements changes. Text values, attributes, comments and CDATA are preserved.
Text next to child elements is kept and placed on its own line, which is easiest to read but can add visible whitespace in mixed-content documents.
Yes. A leading <?xml … ?> declaration and a DOCTYPE are kept at the top.
It works with large pasted XML, limited only by your browser and device memory.
No. Processing happens entirely in your browser.
Explore more free developer tools from MoSanKit.