XML Nerd
A cartoon tree frog in round glasses, thinking

XML Minifier

Strip the whitespace between tags to make XML as small as possible.

Runs in your browser. Nothing you type is uploaded.

How to minify XML

Paste your XML and press Minify. The line breaks and indentation between tags are removed, giving the smallest equivalent text. Tick Remove comments to drop comments as well.

What is kept

Whitespace inside text is never changed, so <name> Ada </name> stays as it is. Elements that mix text and tags keep their spacing, content marked xml:space="preserve" is left alone, and the XML declaration, CDATA and processing instructions are kept.

Why minify XML?

Smaller XML means less to store and send, and it is handy for embedding XML in a script, a request body or a configuration value. For web delivery, compression such as gzip makes a bigger difference than removing whitespace, but minifying first still helps.

FAQ

Is minified XML still valid?

Yes, for data-style XML. Whitespace between tags that only separates elements has no meaning to most applications. If your application treats that whitespace as significant, check the result.

How do I make it readable again?

Use the XML beautifier or the XML formatter.

Is my XML uploaded anywhere?

No. It is minified in your browser.

More XML tools

  • XML formatter: Format, minify and validate XML in one place.
  • XML validator: Check that XML is well-formed and find the exact line and column of an error.
  • XML beautifier: Pretty print XML with 2 spaces, 4 spaces or tabs.
  • XML sitemap generator: Turn a list of URLs into a sitemap.xml file for search engines.