Minify, Unminify & Beautify XML Online — Free XML Minifier

Minify, unminify and beautify your XML code instantly to reduce your file sizes and improve your application performance. Our free online XML minifier removes unnecessary whitespace, comments and optimizes structure while preserving CDATA sections and processing instructions. Instant and secure processing, no registration required.

Loading...
XML Minification
Compressing XML files by removing whitespace, comments and unnecessary characters while preserving CDATA sections and processing instructions

Basic example

Input XML

<?xml version="1.0" encoding="UTF-8"?> <root> <item id="1"> <name>Product</name> <price>29.99</price> </item> <item id="2"> <name>Service</name> <price>49.99</price> </item> </root>

Minified XML

<?xml version="1.0" encoding="UTF-8"?><root><item id="1"><name>Product</name><price>29.99</price></item><item id="2"><name>Service</name><price>49.99</price></item></root>

Minification options

Remove Comments
Removes all XML comments (<!-- ... -->) from code

Comparison with/without option:

Original code
<root> <!-- This is a comment --> <item>Content</item> <!-- Another comment --> </root>
With removeComments: true
<root><item>Content</item></root>
With removeComments: false
<root><!-- This is a comment --><item>Content</item><!-- Another comment --></root>
Collapse Whitespace
Collapses multiple whitespace characters into single spaces and removes spaces between XML tags. Preserves CDATA sections and processing instructions.

Comparison with/without option:

Original code
<root> <item> Multiple spaces </item> <data> Text </data> </root>
With collapseWhitespace: true
<root><item> Multiple spaces </item><data> Text </data></root>
With collapseWhitespace: false
<root><item> Multiple spaces </item><data> Text </data></root>

Other minification tools