← All text tools

XML Minifier

Remove whitespace between tags and strip comments from XML to cut its size, while keeping text nodes and CDATA sections intact.

  • Free
  • No sign-up
  • Works on any device

About XML Minifier

Pretty-printed XML carries a lot of indentation and comments that parsers do not need. This minifier removes the whitespace that sits between tags, strips comments if you like, tidies spacing inside tags, and joins everything into one line, while copying CDATA sections, processing instructions and the DOCTYPE exactly as written. Text inside elements is kept, with optional trimming of its outer edges. The page shows the size before and after in bytes and warns if the input is not well-formed, which helps when you shrink SOAP messages, sitemaps, SVG-like data or configuration files.

How to use XML Minifier

  1. Paste your XML into the box.
  2. Choose whether comments are removed and how the whitespace inside text is handled.
  3. Copy the one-line XML and check the bytes saved.

Why use this tool?

Also known as

Frequently asked questions

Is it safe to remove whitespace between tags?

For data-style XML, yes. For documents that mix text and tags, such as XHTML paragraphs, a space between two inline tags can matter, so check those results by eye.

Are CDATA sections and comments handled correctly?

CDATA is copied untouched, even when it contains characters like < and &. Comments are dropped only when the option is on; otherwise they are kept as they are.

Does the minifier validate the XML?

It runs your browser's XML parser and warns about well-formedness errors, but it still produces a result so you can see what happened. It does not check against a schema.

Is XML Minifier free?

Yes. XML Minifier on Toolipedia is free to use, with no sign-up and no watermark.

Is it safe to use?

Yes. Everything is worked out in your browser, and nothing you enter is sent to our server.

Does it work on my phone?

Yes. It works in any modern browser on Android and iPhone, as well as on tablets and computers. There's nothing to install.

Do I need an account?

No. Just open the page and use the tool. There's no sign-up and no email needed.

Can I put XML Minifier on my own website?

Yes. Use the Embed on your site button under the tool to copy a short piece of code and paste it into your page. It is free, needs no account, and the tool keeps working inside your page.

Related tools