XML Beautify — Online XML Formatter and Pretty-Printer
🔒 Runs in your browser — nothing is sent to a serverXML formatter that turns any compact, minified or hand-written XML into a clean, indented document. Paste a SOAP envelope, an RSS feed, an Android layout, an Excel `.xlsx` part or any blob of XML, and this XML beautifier validates the syntax with the browser's native `DOMParser`, then pretty-prints the tree with 2 or 4 spaces or tab indentation. The XML declaration, DOCTYPE, comments and `CDATA` sections are preserved verbatim; mixed-content elements and `xml:space="preserve"` blocks are left untouched. Everything runs 100% inside your browser; your input never leaves your device, nothing is uploaded, logged or sent to any server.
When to use an XML beautifier
You reach for an XML beautifier any time a one-line XML payload arrives unreadable: debugging a SOAP fault, tracing a SAML assertion through a signed envelope, comparing two SVG fragments with `diff`, peeking inside an Office Open XML part, walking through an Android `AndroidManifest.xml` from a vendor APK, or reviewing the RSS feed your CMS just emitted. The pretty-printed form is what most readers and tools expect, and what `xmllint --format` and IntelliJ both produce. Running the format in a browser-local tool keeps the payload off remote servers — important when the XML carries tokens, signatures or PII.
How XML beautifying works under the hood
XML beautifying is a three-step pipeline. First the input is scanned for the XML declaration and the DOCTYPE — both live outside the document tree, so they are pulled aside before parsing. Second the remainder is fed through `new DOMParser().parseFromString(input, "text/xml")`; a `parsererror` element in the result triggers a clear error message with the offending line and column. Third a recursive tree walker re-emits every element with the chosen indentation, preserving CDATA contents verbatim, keeping comments unless asked to strip them, leaving mixed-content and `xml:space="preserve"` elements on a single line, and breaking long opening tags (>120 characters) onto multiple lines. The whole pipeline runs inside the browser, so a multi-megabyte document beautifies in milliseconds without leaving your tab.
Examples
<?xml version="1.0" encoding="UTF-8"?><catalog><book id="1"><title>Atlas</title><author>A. Reyes</author></book><book id="2"><title>Vesper</title><author>I. Park</author></book></catalog><?xml version="1.0" encoding="UTF-8"?>
<catalog>
<book id="1">
<title>Atlas</title>
<author>A. Reyes</author>
</book>
<book id="2">
<title>Vesper</title>
<author>I. Park</author>
</book>
</catalog><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"></circle><line x1="2" y1="12" x2="22" y2="12"/></svg><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<circle cx="12" cy="12" r="10"/>
<line x1="2" y1="12" x2="22" y2="12"/>
</svg><?xml version="1.0"?><tool><name>xml beautify</name><role>format xml online</role><client>free-converter.online</client></tool><?xml version="1.0"?>
<tool>
<name>xml beautify</name>
<role>format xml online</role>
<client>free-converter.online</client>
</tool><config><!-- production settings --><script><![CDATA[if (a < b) { x = 1; }]]></script></config><config>
<!-- production settings -->
<script><![CDATA[if (a < b) { x = 1; }]]></script>
</config>