XML Formatter
Pretty-print XML with proper indentation, collapse it to a single line, or minify it for production. Perfect for debugging API responses and cleaning up exported SVGs. Runs in your browser.
About XML Formatter
Pretty-prints, collapses, or minifies XML. Convert XML to JSON with theXML to JSON tool, or generate XML from JSON using JSON to XML.
Secure & Private Client-Side
This tool runs entirely in your browser. No data is sent to any server, ensuring your information remains private and secure.
About XML Formatter
Pretty-print XML with proper indentation, collapse it to a single line, or minify it for production. Perfect for debugging API responses and cleaning up exported SVGs. Runs in your browser.
Frequently Asked Questions
How is indentation handled? expand_more
The pretty mode uses two spaces per nesting level and inserts line breaks between elements. Self-closing and text elements are preserved.
Does the minifier remove CDATA? expand_more
No. CDATA sections and text content are preserved; only insignificant whitespace between tags is removed.
Can I convert XML to JSON? expand_more
Yes. Use [XML to JSON](/tools/xml-to-json/) after formatting, or generate XML from JSON with [JSON to XML](/tools/json-to-xml/).
Does it validate XML? expand_more
Basic well-formedness is enforced during formatting, but full schema (XSD) validation is not performed.
Is my XML uploaded? expand_more
No. Everything runs locally in your browser.
Common Use Cases
- Debugging: Pretty-print minified XML responses from APIs for easier inspection.
- SVG Cleanup: Reformat messy SVG markup exported from design tools.
- Config Files: Normalize indentation in Maven, Spring, or Android XML files.
- Production Bundles: Minify XML configuration before shipping to reduce payload size.