XML Minifier
This XML minifier removes the whitespace between tags and, optionally, the comments, producing markup that parses to exactly the same document. Text inside an element is never altered and CDATA sections are passed through byte for byte, so nothing you actually wrote is changed. Indented XML is mostly indentation — documents nested several levels deep typically shrink by 20 to 40 percent, and the saving grows with depth because every level adds its indent to every line beneath it. Minification runs entirely in your browser.
How it works
Strips the whitespace between tags and, by default, the comments, leaving markup that parses to exactly the same document. Useful before putting XML on the wire, into a message queue, or inside another field.
Text inside an element is left alone, and CDATA sections are never touched, so no content is altered.
Everything runs in your browser — nothing you paste is sent to a server.
How to minify XML
- Paste your XML into the input on the left.
- The whitespace between tags is removed and the result appears on the right.
- Keep or drop comments with the checkbox, then copy or download.
What is removed, and what is not
Only the whitespace between tags goes, along with comments if you leave that option on. Text inside an element is never touched, and CDATA sections are passed through byte for byte — so the minified document parses to exactly the same data as the original.
How much smaller
Indented XML is mostly indentation. Documents that nest several levels deep typically shrink by 20 to 40 percent, and the saving grows with depth, since every level adds its indent to every line beneath it.
Common use cases
- Shrinking a request or response body before sending it over the network.
- Storing XML in a database column or message queue where size is billed.
- Preparing a document to embed inside another field or a string literal.
Frequently asked questions
Does minifying change what my XML means?
No. Only the whitespace between tags is removed, so the minified document parses to exactly the same elements, attributes and values as the original.
Is text inside elements affected?
No. Text content is left exactly as written, and CDATA sections are passed through unchanged, because whitespace inside them can be significant.
How much smaller does XML get?
Typically 20 to 40 percent for human-indented documents. The deeper the nesting, the bigger the saving, since every extra level adds indentation to every line below it.
Should I remove the comments?
Remove them when the document is heading for a machine — a request body, a queue message, a database column. Keep them when a person will read the result.
Is my data uploaded when I minify?
No. Minification happens entirely in your browser, so nothing is transmitted.
Related tools
XML Formatter & Beautifier
This XML formatter re-indents minified or messy XML while preserving comments and CDATA.
XML Validator
This XML validator checks well-formedness and pinpoints the line and column of the first error.
XML to String Converter
This XML to string converter escapes a document into a single-line literal you can embed anywhere.