How to use
- Click Paste to insert XML from your clipboard, or Upload to open a file.
- Set Mode to Beautify for readable indentation or Minify for compact XML.
- For Beautify, set Indent to 2 spaces, 4 spaces or Tab.
- Leave Live on for automatic formatting, or turn it off and click Format.
- Click Copy or Download to save the result, or Apply to editor to continue editing it.
Examples
Pretty-print an RSS feed
<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"><channel><title>Austin Neighborhood News</title><link>https://example.com/news</link><!-- Latest story --><item><title>Saturday farmers market</title><description><![CDATA[<p>Open from 9 a.m. to noon.</p>]]></description></item></channel></rss>
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
<channel>
<title>Austin Neighborhood News</title>
<link>https://example.com/news</link>
<!-- Latest story -->
<item>
<title>Saturday farmers market</title>
<description><![CDATA[<p>Open from 9 a.m. to noon.</p>]]></description>
</item>
</channel>
</rss>Put SVG attributes on separate lines
<svg xmlns="http://www.w3.org/2000/svg" width="240" height="80" viewBox="0 0 240 80"><rect x="10" y="10" width="220" height="60" rx="8" fill="#2563eb"/><text x="120" y="46" text-anchor="middle" fill="white">Welcome</text></svg>
<svg
xmlns="http://www.w3.org/2000/svg"
width="240"
height="80"
viewBox="0 0 240 80">
<rect
x="10"
y="10"
width="220"
height="60"
rx="8"
fill="#2563eb"/>
<text
x="120"
y="46"
text-anchor="middle"
fill="white">Welcome</text>
</svg>Minify a config, remove comments and self-close empty elements
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<!-- Local development settings -->
<appSettings>
<add key="SiteName" value="Portland Bike Shop"></add>
<add key="SupportEmail" value="support@example.com"></add>
</appSettings>
</configuration><?xml version="1.0" encoding="UTF-8"?><configuration><appSettings><add key="SiteName" value="Portland Bike Shop"/><add key="SupportEmail" value="support@example.com"/></appSettings></configuration>
FAQ
Does formatting XML change its content?
Text, mixed content and content inside xml:space="preserve" retain their whitespace. Tags are normalized, while attribute quote styles, values, CDATA and entity references are kept as written; comments and the XML declaration remain unless you enable Remove comments or Remove XML declaration.
Does this XML formatter validate against an XSD or DTD?
It checks XML well-formedness, including matching tags, quoted attributes and a single root element. It does not validate against an XSD or DTD or check namespace declarations, and it never fetches external DTDs.
Why is my XML invalid?
Check for unclosed or mismatched tags, multiple root elements, or a bare & that needs to be written as &. HTML entities such as are undefined unless declared; use   for a non-breaking space. Click the line and column message in Invalid XML to move to the error.
Is my XML uploaded or saved?
Your XML is processed in your browser and is not uploaded or saved by the formatter; only option settings are saved locally. Using Convert to JSON → temporarily passes the XML through browser sessionStorage, which the destination page clears after reading.
How large an XML file can I format?
Uploads over 50 MB are rejected, and nesting is limited to 1,000 levels. Above 1 MB, automatic formatting stops and you use Format instead; syntax highlighting is disabled above 5 MB.