XML Minifier
Removes comments and the whitespace between elements, and reports how many bytes that saved.
Loading the tool…
How to use this tool
- Paste the formatted XML you want compressed.
- Select Minify and read the byte saving in the summary.
- If the consumer is strict about whitespace, parse one value from both versions and compare before shipping the smaller file.
What xml minifier does
Minifying XML removes the indentation and line breaks between elements, and removes comments. What it cannot safely do is decide that whitespace is meaningless, because in XML that is a decision only the schema can make. This tool takes the common case: whitespace between two elements is layout, whitespace inside a text-only element is trimmed at each end, and everything else is left alone.
That is right for the great majority of documents — configuration, feeds, exports, SOAP payloads — and wrong for a document that uses xml:space="preserve" or a schema whose type is defined to keep leading spaces. If you are minifying something whose whitespace rules you do not control, compare a parsed value before and after rather than trusting the byte count.