XML Formatter

Format XML for readability. Free, instant.

\\n<').split('\\n').forEach(l=>{l=l.trim();if(!l)return;if(l.match(/^<\\//))p--;r+=' '.repeat(Math.max(0,p))+l+'\\n';if(l.match(/^<[^/!?]/)&&!l.match(/\\/>/)&&!l.match(/<.*<\\//))p++});return r.trim();"}'>

How to Use XML Formatter

1

Paste XML.

2

Get formatted output.

3

Copy or download your result.

Frequently Asked Questions

XML vs HTML?

XML is stricter — all tags must close, attributes must be quoted, case-sensitive.