How to Use the XML Minifier
- Paste or enter your input into the text field.
- Configure any options (format, delimiter, encoding, or mode) using the controls above the output.
- The result updates instantly — no submit button required for most operations.
- Click Copy or Download to take the output to your next step.
Compress an XML document by stripping the parts that parsers ignore: comments (<!-- … -->), whitespace between elements (>\s+<), and runs of more than one consecutive space inside text. The result is functionally identical XML — it parses to the same DOM — just smaller and faster to transmit.
How the XML Minifier Works
Useful for production sitemaps, SOAP envelopes, RSS feeds, and any XML payload that’s served over the wire repeatedly. Before/after byte counts and percent saved are shown after each run. For mixed-content XML where inter-element whitespace is meaningful (some XHTML, MathML), keep the original or use a parser-aware minifier.
- Removes <!-- ... --> comments
- Collapses whitespace between elements (>...<)
- Reduces multi-space runs to a single space
- Reports before/after size and percent saved
Frequently Asked Questions
Is whitespace inside text nodes preserved?
Yes — only whitespace between tags and runs of more than one space inside text are touched. Single spaces, line breaks, and tabs that are part of meaningful text content are kept. For mixed-content XML where whitespace is significant (some XHTML, MathML), turn the space-collapse option off.
Will the minified XML still parse?
Yes — the tool only strips characters that XML parsers ignore. The element tree, attribute order, and CDATA sections are unchanged. Run the output through an XML validator if you want to be sure.
How much size reduction can I expect?
Hand-formatted XML typically shrinks 20–60 % depending on indentation and comment volume. Sitemaps, SOAP envelopes, and RSS feeds with deep nesting see the biggest savings.
Is the XML uploaded anywhere?
No — minification is a local JavaScript regex pass. Nothing leaves the page.
Explore the full suite of CODE tools and 290+ other free utilities at Chunky Munster.