Illustration of minified XML expanding into a neatly indented, nested tree structure

XML Formatter / Minifier

Paste XML and format it (indented, one element per line) or minify it (no whitespace between tags). Preserves comments, CDATA sections, the XML declaration, and meaningful whitespace inside mixed content (text next to inline elements). Runs entirely in your browser.


💻 Show API usage examples (cURL)
curl -sS -X POST https://devops.majbase.com/xml-formatter/api -H "Content-Type: application/json" -d '{"action":"format","xml":"<root><a>1</a></root>"}'
curl -sS -X POST https://devops.majbase.com/xml-formatter/api -H "Content-Type: application/json" -d '{"action":"minify","xml":"<root>\n  <a>1</a>\n</root>"}'

Returns {"result": "..."}, or {"error": "..."}.