XML Formatter
100% FreePretty-print or minify XML — handles XML declarations, comments, CDATA, self-closing tags, and HTML void elements.
Paste XML above…Embed This Tool
Easy to EmbedAdd XML Formatter to your website or blog in seconds.
- Responsive design
- Lightweight & fast
- No backend required
- Always up-to-date
<iframe
src="https://tools.town/embed/xml-formatter/"
width="100%"
height="600"
style="border:none; border-radius:12px;"
loading="lazy"
title="XML Formatter">
</iframe> Advertisement
How to Use
- 1 Paste any XML into the input box (or click 'Load sample')
- 2 Pick mode — Pretty (indented) or Minify (single-line)
- 3 For Pretty mode, choose 2-space, 4-space, or tab indent
- 4 Output updates as you type — copy with one click
Features
- Pretty-print and minify modes
- Three indent options (2/4/tab)
- Preserves XML declaration `<?xml ?>`, comments, CDATA blocks
- Handles HTML void elements (br, img, hr) as self-closing
- Counts opening tags for quick complexity check
- 100% client-side
Why it Matters
XML from a SOAP response or RSS feed often arrives as a wall of text on a single line — almost unreadable in a terminal. A reliable formatter that preserves CDATA verbatim and doesn't choke on processing instructions is the fastest path to understanding what you're looking at.
Use Cases
SOAP Response Debug
Pretty-print a SOAP envelope to find the bad element
RSS / Sitemap Cleanup
Format RSS/sitemap XML for human review before publishing
Bundle Minification
Strip whitespace from XML before embedding in code
Frequently Asked Questions
Can it validate XML against a schema (XSD)?
Why does it preserve CDATA exactly?
Will it handle malformed XML?
Does it support XML namespaces?
Want to understand the math?
Related Tools You Might Like
JSON Formatter
Beautify, minify, and sort-key JSON in real time. Surfaces parse errors with line + column. 100% client-side.
JSON to XML Converter
Convert JSON to well-formed XML — configurable root element, repeated elements for arrays, escaped special chars, optional XML declaration.
CSV to JSON Converter
Parse CSV (RFC 4180) into structured JSON — quoted fields, embedded newlines, auto-typing for numbers/booleans, instant download.
JSON to CSV Converter
Convert JSON arrays into CSV — RFC 4180 escaping, configurable delimiter, optional flatten of nested objects, instant download.
JSON Validator
Validate JSON in real time with structural diagnostics — node count, max depth, type counts, and precise parse-error location.