Code · Made a little simpler

XML Compressor

Compress XML locally and compare UTF-8 sizes. Compact empty elements, optionally strip comments and indentation, and preserve mixed text and xml:space.

Free to useNo account neededProcessed on your device
Your workspaceProcessed on your device

Add this tool to your website

Paste this code into your page to add the tool and a visible ToolMellow credit link.

HTML embed code
Preview embed

XML Compressor: how to use it

  1. Supply an XML document and compress once with the default settings.
  2. Optionally remove comments or whitespace between element-only children.
  3. Review the byte counts and output, then download compressed.xml.

Limits and notes

Local files must be UTF-8 and at most 4 MiB. XML input supports up to one million UTF-16 code units, 100,000 nodes and 128 element levels. DTDs are excluded. Normalization can change attribute quoting, character references and empty-element spelling. Optional indentation removal respects inherited xml:space="preserve". Digital signatures depend on separate canonicalization rules.

How your privacy works →

XML Compressor: common questions

Will the compressor join words around an inline element?

An element containing non-whitespace text or CDATA keeps its child text. Optional indentation removal applies to whitespace-only children of an otherwise element-only container.

Why is a compact file the same size as the input?

The default mode keeps the input when normalized markup would be larger. The measured byte counts report the actual result.

Guides