XML Minifier

Compress XML without breaking CDATA, namespaces, or xml:space - free, no signup required.

Input XML
Minified Output
Original: 0 B Minified: 0 B Saved: 0.0%

XML Full Form

XML stands for eXtensible Markup Language - a structured text format used for configuration files, document storage (OpenDocument, OOXML), enterprise message payloads (SOAP), feeds (RSS, Atom), and many other data interchange scenarios. XML files are typically pretty-printed with indentation and comments for humans; minification strips those away to reduce size.

What this tool does

When you need an XML minifier

How to use it

  1. Paste XML into Input XML, or click Upload File to open an .xml, .rss or .atom file. Load Sample loads a small RSS feed.
  2. The output on the right refreshes as you type. Click Minify to run it again.
  3. Compare the original and minified sizes in the stats line.
  4. Click Copy, or Download to save minified.xml.
  5. Need to read a compressed file? Paste it and click Beautify to put each element on its own indented line.

A worked example

Here is a small price list, 153 bytes as it would sit in a file with indentation:

<?xml version="1.0"?> <!-- price list --> <items> <item sku="A1"> <name>Blue mug</name> <price currency="INR">249</price> </item> </items>

The minifier returns <?xml version="1.0"?><items><item sku="A1"><name>Blue mug</name><price currency="INR">249</price></item></items>, which is 112 bytes, about 27% smaller. The declaration and every attribute survive, the comment is gone, and the three spaces typed between "Blue" and "mug" are now one.

How it decides what to remove

The tool reads the document piece by piece: tags with their attributes, comments, CDATA sections, processing instructions, the DOCTYPE and text. It removes comments, deletes whitespace that sits only between two tags, and reduces any other run of spaces, tabs and newlines in text to a single space. Attribute values, CDATA and text under xml:space="preserve" are copied unchanged. It never decodes entities, so &amp; and &#169; stay exactly as written, and it does not validate the document, so it will not complain about a malformed file. Validate important files separately.

Where whitespace really matters

Privacy

Everything runs locally in your browser. Your XML is never sent to our servers. You can minify internal configs, SOAP envelopes with auth tokens, or private document payloads without anything leaving your machine.

Frequently Asked Questions

Will minifying break my signed or validated XML?
If your XML is signed (XML Digital Signature) or canonicalized before hashing, do not minify after signing - whitespace changes invalidate the signature. Minify first, then sign. The tool preserves CDATA and xml:space="preserve", which covers the common cases where whitespace is semantically meaningful.
Does it preserve namespaces and attributes?
Yes. Namespace declarations, attributes and processing instructions (<?xml ...?>) are kept, and every attribute value is copied byte for byte, repeated spaces included.
What about entity references like &amp;?
Entity references are passed through untouched. The minifier is a text-level tool - it does not parse to a DOM or decode entities, so &amp;, &lt;, &#123; and custom entities are preserved exactly.
How much can I realistically save?
Indented XML usually shrinks by 20-50%, depending on nesting depth and verbosity. After gzip the savings are smaller but real - minification removes bytes the compressor still has to encode.
Is my XML uploaded anywhere?
No. All minification happens in your browser. Nothing is sent to our servers, logged, or cached anywhere except the current browser tab.
Can I reverse the minification?
Click Beautify to indent the XML with one element per line. Stripped comments are not recoverable, but the tag structure is fully restored and readable.