XML Minifier

Strip indentation and line breaks from XML to make it as small as possible for transport or storage. Element names, attributes, text, comments, CDATA, and the XML declaration are all preserved. Everything runs in your browser, nothing is uploaded.

XML
Minified
Result will appear here
Ready. Press Minify or Ctrl+Enter.

How to use the XML Minifier

  1. Paste XML into the input pane.
  2. Press Minify.
  3. Copy the compact output.

Example

The formatted catalog collapses to a single line.

<catalog><book id="1"><title>JSON Basics</title><author>Ada</author><empty/><price>9.99</price></book><book id="2"><title>XML Guide</title></book></catalog>

Frequently asked questions

Is anything lost when minifying?

No. Only whitespace between elements is removed. Element names, attributes, text, comments, and CDATA are unchanged.

Can I get the formatting back?

Yes. Paste the minified XML into the XML Formatter and it restores the indentation.