About this XML Beautifier & Formatter
This XML formatter parses your XML and rewrites it with one element per line and consistent indentation. Comments, CDATA sections, processing instructions and the XML declaration are kept.
If your XML isn't well-formed (an unclosed tag, a bad attribute or a stray &), the XML validator tells you so instead of producing broken output.
Features
- Pretty print XML with custom indent
- XML well-formedness validation
- XML minifier
- Keeps comments, CDATA and the XML declaration
- Works with SOAP, RSS, Atom, SVG, sitemap.xml, Android and Maven files
How to use
- Paste XML into the Input box or open an .xml file.
- Press Beautify.
- Use Minify to remove whitespace between tags.
- Copy the formatted XML.
Example
Before
<note><to>Ravi</to><from>Asha</from><body>Meet at 5</body></note>
After
<note>
<to>Ravi</to>
<from>Asha</from>
<body>Meet at 5</body>
</note>
Frequently asked questions
How do I pretty print XML?
Paste the XML above and click Beautify. Each element is placed on its own line and indented according to how deeply it's nested.
Does the XML beautifier change my data?
No. Only whitespace between elements changes. Element names, attributes and text content stay the same.
Can I format SVG files?
Yes. SVG is XML, so you can paste or open an .svg file and format it here.
More free formatters
- BeautifyAll-in-one beautifier
- JSON Beautifier & FormatterFormat & validate JSON
- HTML Beautifier & FormatterClean up HTML markup
- CSS Beautifier & FormatterFormat CSS, SCSS & LESS
- JavaScript Beautifier & FormatterBeautify JS code
- TypeScript Formatter & BeautifierFormat TS code
- SQL Formatter & BeautifierFormat SQL queries
- YAML Formatter & ValidatorFix YAML indentation
- Markdown FormatterTidy Markdown docs
- GraphQL FormatterFormat GraphQL queries
- Text BeautifierClean up plain text