Input
Ready
Lines: 0
Words: 0
Chars: 0
Size: 0 KB
Input statistics are available via the Stats button above this field.
Output
Lines: 0
Words: 0
Chars: 0
Size: 0 KB
Output statistics are available via the Stats button above this field.
Results are provided for informational purposes only and may contain errors. Please verify important information independently. Use of this tool is at your own risk.
What the XML Formatter & Beautifier does
The XML Formatter re-indents XML so each element starts on its own line with two spaces per nesting level. It turns a single-line API response or a messy export into a structure you can read and review.
Attributes, element order, comments and CDATA sections are preserved, and the old indentation is replaced rather than added to. Empty elements are written in the short form <tag/>, and an XML declaration is added at the top.
When to use it
- Reading a minified SOAP response, sitemap, RSS feed or configuration file.
- Reviewing changes: format two versions the same way, then compare them with the Text Diff Checker.
- Preparing a readable sample for documentation or a support ticket.
- Making machine-generated XML from an export, a build tool or a report easy to scan before editing it by hand.
Worked example
Input
<catalog><book id="b1"><title>Dune</title><year>1965</year></book><book id="b2"><title>Neuromancer</title><year>1984</year></book></catalog>
Output
<?xml version="1.0" encoding="UTF-8"?>
<catalog>
<book id="b1">
<title>Dune</title>
<year>1965</year>
</book>
<book id="b2">
<title>Neuromancer</title>
<year>1984</year>
</book>
</catalog>Common questions about the XML Formatter & Beautifier
How do I format the XML?
Paste the XML into the input box and click the Pretty button above it. The formatted result replaces the input, so you can copy or download it straight away. If the XML is in the output box, use the Pretty button above the output box instead.
What if my XML is not well-formed?
Formatting needs a document that parses, so unclosed or mismatched tags are reported instead of being formatted. Find the exact problem with the XML Validator, fix it, then format again.
Does formatting change the meaning of the XML?
Not for data documents. Whitespace that only indents elements is not significant. In mixed-content documents where spaces between inline tags matter, review the result before using it.
Is this tool free?
Yes, it's free to use. No signup, no email required. Get results on this page.
How do I get my result?
Use the tool on this page. Your result appears here; no email delivery is required.