Skip to tools

Minifiers

XML Minifier

Indented XML can be twice the size of the data it carries. The XML Minifier removes the whitespace between tags so the document becomes a compact single line that is cheaper to store and transmit.

It is a quick way to prepare XML for embedding in another file, a database column or a request body.

How to use the XML Minifier

  1. 1Use the XML Minifier right on this page, or open the full workspace for history, sharing and every other tool.
  2. 2Paste your input, upload a file, or drag and drop a file onto the input box (up to 25 MB).
  3. 3The result appears in the output panel automatically and updates when you change the input or an option.
  4. 4Use Copy Output or Download to save the result. Nothing is uploaded to a server.

Example

An indented XML document is collapsed onto one line with no whitespace between tags.

Input
<root>
  <a>1</a>
  <b>2</b>
</root>
Output
<root><a>1</a><b>2</b></root>

When to use it

  • Compacting XML payloads before sending them to a SOAP endpoint
  • Storing XML snippets in a database field or a JSON string
  • Reducing the size of generated feeds or exports

Tips and common mistakes

  • Text content, CDATA sections, comments and attribute values are copied exactly — only whitespace between tags is removed.
  • Upload files up to 25 MB, or drag them straight onto the input box.
  • Run the XML Formatter afterwards to read the document again.

Frequently asked questions

Does minifying remove comments?

No. Comments are kept exactly as written, along with CDATA sections.

Will it change my attribute values or text?

No. Values such as id="A 1" or <code> 007 </code> keep every space and leading zero; only the indentation between elements is dropped.

TutorialXML explained: still relevant, still everywhere

Related tools

Ready to try it?

Free, no sign-up, and your data never leaves your browser.