XML Formatter
Pretty-print XML with 2 or 4 spaces, validate matching tags, and minify XML documents 100% locally in your browser.
How It Works
- Paste raw or minified XML into the editor (or load the sample XML).
- Choose 2-space or 4-space indentation and click Format & Validate—or click Minify XML.
- Copy the formatted XML or download it as a .xml file.
Frequently Asked Questions
Does this check for unclosed or mismatched XML tags?
Yes. Every opening and closing tag is validated in order, and any mismatched or unclosed tag is reported immediately.
Are XML comments, processing instructions, and CDATA preserved?
Yes. XML declarations (<?xml ...?>), comments, and CDATA blocks are preserved cleanly during formatting and minification.