XML Minifier

XML Minifier

Updated August 20, 2026

XML minifier online. Compress XML by removing extra spaces. Minify XML files free in your browser.

Input XML

0 lines · 0 chars

Loading editor...

Minified XML

0 lines · 0 chars read-only

Loading editor...

Features

  • Remove insignificant whitespace between tags
  • Keep the XML declaration when present
  • Preserve CDATA and comments
  • Show before/after byte counts
  • Copy or download the compact payload
  • Runs locally so SOAP bodies with credentials are not uploaded

Common Use Cases

  • Shrink an XML fixture used in tests
  • Fit a SOAP example into a ticket without wrapping
  • Compare compact vs pretty size before putting XML in a QR or SMS (rare, but it happens)
  • Normalize documents before a byte-level hash
  • Prepare a compact sample for an API mock

When minifying XML is safe

Minifying XML deletes whitespace that sits between elements. Element-only trees (the usual API and config case) keep the same information set. Mixed content, xml:space="preserve", and significant newlines in text nodes are the exceptions.

This minifier parses first. Broken XML is not “minified” into something worse. Comments stay, which is unlike some production minifiers. Strip comments yourself if you need a smaller secret-free sample.

Examples

Valid - Pretty input
<a>
  <b>1</b>
</a>
Valid - Already compact
<a><b>1</b></a>
Invalid - Broken, will not minify
<a><b>1</a>

Frequently Asked Questions

Will minifying break my signature?

If a signature covers canonical XML, pretty vs minified already differs. If it covers raw bytes, any whitespace change invalidates it. Do not minify a signed envelope unless you re-sign.

Are comments removed?

No. Remove them in an editor if the comment is the secret.

Tips

  • Minify after you have a green validator result.
  • Gzip of pretty XML and minified XML is often close. Minify for readability of the on-wire sample, not as a compression strategy.