Clean, well-formed XML
Paste XML — a sitemap, an RSS feed, a SOAP response, an Android layout or a config file — and the formatter re-indents every element so the hierarchy is obvious at a glance. The XML declaration, doctype, comments and CDATA sections are preserved exactly.
The formatter parses your input with the browser's strict XML parser, so it also works as a well-formedness checker: unclosed tags, mismatched names, bad characters and unescaped ampersands are reported with a line number. When you're done, minify the XML to strip indentation for the smallest possible file.
How to format XML
- 1
Paste your XML
Or open an .xml file.
- 2
Choose indentation or minify
2 spaces, 4 spaces, tabs or a single line.
- 3
Fix any errors
The error message shows the line to look at.
- 4
Copy or download
Save the formatted file.
Key features
Strict parsing
Catches mismatched and unclosed tags.
Keeps everything
Declaration, doctype, comments and CDATA are preserved.
Minify option
Removes whitespace between tags.
Private
Your XML stays in your browser.
Common uses
- Sitemaps and feeds: Inspect sitemap.xml or an RSS feed before submitting it.
- SOAP and legacy APIs: Read verbose XML responses comfortably.
- Office and app files: Tidy XML extracted from DOCX, Android or Maven projects.
Tips and good to know
- An unescaped
&is the most common XML error. Write it as&or use the HTML Entity Encoder. - Working with JSON instead? Use the JSON Formatter.
