About the XML Formatter
Beautify XML with clean indentation or minify it to a single line, and check that it's well-formed. Works with RSS feeds, SVG, sitemaps, SOAP messages and config files.
Key features
- Beautify or minify XML
- Checks that XML is well-formed
- Error messages with line and column
- Keeps the XML declaration, CDATA and processing instructions
- Option to remove comments
- Works with RSS, SVG, sitemaps, SOAP and config files
Format and check XML
Paste XML from an API response, a config file, an RSS feed or a sitemap to indent it neatly, or minify it to save space. Errors such as mismatched tags are reported with their position.
Before and after
<catalog><book id="1"><title>XML Guide</title><price>44.95</price></book></catalog>
becomes
<catalog>
<book id="1">
<title>XML Guide</title>
<price>44.95</price>
</book>
</catalog>
Common XML errors
| Error | Cause |
|---|---|
| Opening and ending tag mismatch | A closing tag doesn't match the open element, e.g. <a><b></a> |
| Extra content at the end of the document | More than one root element |
| Attributes construct error | An attribute value isn't quoted |
| EntityRef: expecting ';' | A bare & in text; write & instead |
Related tools
JSON to XML, sitemap generator, and YAML validator.
How to use the XML Formatter
- Paste your code into the input box, upload a file, or click Sample to try it out.
- Choose the options you want, such as indentation, line width or dialect.
- The result appears instantly in the output panel. Syntax errors are shown with their line and column.
- Click Copy to copy the result, or Download to save it as a file.