XML Minify — Compress and Reduce XML Size Online
🔒 Runs in your browser — nothing is sent to a serverXML minify any pretty-printed or hand-formatted XML into the smallest valid representation in a single click. Paste a SOAP envelope, an SVG, an Office Open XML part or any XML blob, and this XML minifier validates the syntax with the browser's native `DOMParser`, strips whitespace between tags, removes comments by default and emits a single-line document. CDATA sections, the XML declaration, DOCTYPE and `xml:space="preserve"` blocks are left untouched; mixed-content elements stay intact unless you opt into Aggressive mode. 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 minifier
You reach for an XML minifier any time an XML document needs to travel across a constrained channel: a SOAP API where every kilobyte counts toward CDN bills, an SVG sprite baked into a CSS bundle whose size affects Lighthouse scores, an `.xlsx` part being repackaged before upload, an RSS feed served at high QPS, or an Android resource being squeezed before shipping. Browser-local minification means the payload never touches a server during the transform — important when the XML carries SAML assertions, signed envelopes, tokens or PII you would rather not leak to a remote tool.
How XML minifying works under the hood
XML minifying 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 and re-attached to the output. 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 no whitespace between sibling tags, drops comments unless asked to keep them, and leaves CDATA, `xml:space="preserve"` and mixed-content elements untouched. Aggressive mode bypasses that last guard. The whole pipeline runs inside the browser, so a multi-megabyte XML document minifies 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"/>
<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 minify</name>
<role>compress xml for transport</role>
<client>free-converter.online</client>
</tool><?xml version="1.0"?><tool><name>xml minify</name><role>compress xml for transport</role><client>free-converter.online</client></tool><config>
<!-- production settings -->
<script><![CDATA[if (a < b) { x = 1; }]]></script>
</config><config><script><![CDATA[if (a < b) { x = 1; }]]></script></config>