Compress XML without breaking CDATA, namespaces, or xml:space - free, no signup required.
Input XML
Minified Output
Original: 0 BMinified: 0 BSaved: 0.0%
XML Full Form
XML stands for eXtensible Markup Language - a structured text format used for configuration files, document storage (OpenDocument, OOXML), enterprise message payloads (SOAP), feeds (RSS, Atom), and many other data interchange scenarios. XML files are typically pretty-printed with indentation and comments for humans; minification strips those away to reduce size.
What this tool does
Strip comments - Removes <!-- ... --> comments.
Collapse whitespace - Removes indentation and newlines between tags and inside text nodes, and reduces the gaps between attributes inside a tag to one space.
Keep attribute values exactly - Everything between the quotes of an attribute is copied byte-for-byte.
Preserve CDATA - Contents of <![CDATA[...]]> sections are kept byte-for-byte.
Respect xml:space="preserve" - Text inside elements marked with this attribute, and inside their children, is left untouched.
Byte savings - See original vs minified byte counts and percentage saved.
When you need an XML minifier
API payloads - SOAP, legacy REST, and SAP/Oracle interfaces still exchange XML. Minified payloads travel faster.
Configuration files - Spring, Ant, Maven, and Android manifests where you want a compact committed version.
Feeds - RSS and Atom feeds served at scale benefit from every byte saved.
Sitemaps - Search-engine sitemaps have a 50 MB limit; minifying lets you pack more URLs per file.
How to use it
Paste XML into Input XML, or click Upload File to open an .xml, .rss or .atom file. Load Sample loads a small RSS feed.
The output on the right refreshes as you type. Click Minify to run it again.
Compare the original and minified sizes in the stats line.
Click Copy, or Download to save minified.xml.
Need to read a compressed file? Paste it and click Beautify to put each element on its own indented line.
A worked example
Here is a small price list, 153 bytes as it would sit in a file with indentation:
The minifier returns <?xml version="1.0"?><items><item sku="A1"><name>Blue mug</name><price currency="INR">249</price></item></items>, which is 112 bytes, about 27% smaller. The declaration and every attribute survive, the comment is gone, and the three spaces typed between "Blue" and "mug" are now one.
How it decides what to remove
The tool reads the document piece by piece: tags with their attributes, comments, CDATA sections, processing instructions, the DOCTYPE and text. It removes comments, deletes whitespace that sits only between two tags, and reduces any other run of spaces, tabs and newlines in text to a single space. Attribute values, CDATA and text under xml:space="preserve" are copied unchanged. It never decodes entities, so & and © stay exactly as written, and it does not validate the document, so it will not complain about a malformed file. Validate important files separately.
Where whitespace really matters
Text content - if an element's text must keep repeated spaces or line breaks, such as an address block or a poem, mark it with xml:space="preserve" or wrap it in CDATA before minifying.
Attribute values - kept byte for byte, so note="x y" keeps all three spaces and an attribute that holds formatted text is safe.
Mixed content - in document formats where text and tags mix, the gap between two adjacent inline elements is removed, which can join words together.
Signatures - an XML digital signature covers the exact bytes. Minify before signing, never after.
Privacy
Everything runs locally in your browser. Your XML is never sent to our servers. You can minify internal configs, SOAP envelopes with auth tokens, or private document payloads without anything leaving your machine.
Frequently Asked Questions
Will minifying break my signed or validated XML?
If your XML is signed (XML Digital Signature) or canonicalized before hashing, do not minify after signing - whitespace changes invalidate the signature. Minify first, then sign. The tool preserves CDATA and xml:space="preserve", which covers the common cases where whitespace is semantically meaningful.
Does it preserve namespaces and attributes?
Yes. Namespace declarations, attributes and processing instructions (<?xml ...?>) are kept, and every attribute value is copied byte for byte, repeated spaces included.
What about entity references like &?
Entity references are passed through untouched. The minifier is a text-level tool - it does not parse to a DOM or decode entities, so &, <, { and custom entities are preserved exactly.
How much can I realistically save?
Indented XML usually shrinks by 20-50%, depending on nesting depth and verbosity. After gzip the savings are smaller but real - minification removes bytes the compressor still has to encode.
Is my XML uploaded anywhere?
No. All minification happens in your browser. Nothing is sent to our servers, logged, or cached anywhere except the current browser tab.
Can I reverse the minification?
Click Beautify to indent the XML with one element per line. Stripped comments are not recoverable, but the tag structure is fully restored and readable.
By continuing, you agree to our
Terms of Use and
Privacy Policy,
and confirm you are at least 13 years old.
You're offline
Check your connection. This page will reload on its own the moment you're back online.
Trying to reconnect...
Choose an imageUpload a new picture, or pick one you have used before.
Drag a picture hereAdd a photo from your phone
JPG, PNG, WebP or GIF. Big photos are made smaller for you. You can also paste a picture. You can crop it next.
Uploading
That did not upload.
Drop to upload
Your pictures
No picture matches that name.
Crop imageDrag to reposition · zoom to crop, or fit the whole image