Loona Automation logoLoona Developer Tools
Home › Code Generators

XML Minifier

In short: compress XML by removing comments and the whitespace between tags — the formatting that costs bytes but carries no data.
🔒 Private by design: everything runs in your browser on this device. Your input is never uploaded to a server.

Example

Input:

<a>  <b>x</b>  </a>

Output:

<a><b>x</b></a>

About this converter

For data XML (sitemaps, feeds, config payloads, SVG), the indentation is for humans and the bytes are for machines. This minifier removes comments and inter-element whitespace only — text content inside elements is preserved, because in XML, unlike HTML, whitespace can be significant (xml:space="preserve" exists for a reason), and the tool will not guess otherwise. If your XML is a document format (DocBook, XHTML), keep your formatting; if it is data, minified output parses to the identical tree.

Frequently Asked Questions

Is whitespace inside elements touched?

No — only whitespace strictly between tags and comments are removed. Element text is preserved verbatim.

Does the output stay well-formed?

The transformation cannot unbalance tags; if the input parsed, the output parses to the same tree.

Related Developer Tools

Embed this tool on your website — free

Add this tool to your own website or blog — it is completely free, needs no sign-up, and always shows the latest version. Copy the code below and paste it into your page where you want the tool to appear. Keeping the small “Powered by Loona Automation” credit line under the embed helps keep this tool free — but you are free to style or remove it; the tool works either way.