Minify XML files in your browser

A conservative XML tokeniser removes indentation and comments without borrowing any of HTML’s unsafe shortcuts.

XML
No XML selected
Drop a file to start
Drop XML files here

or browse your device. Everything is processed on this device

No XML to hand?

Got it on your clipboard?

How to minify XML

01
Drop the XML file

Choose one file or a batch. Parsing and minification happen on this device, with no upload in the middle.

02
Choose whether comments stay

Ordinary comments come out by default. Licence notices remain, and the switch can keep every comment when the file uses them as documentation.

03
Inspect the source

The preview shows the exact before and after text. Namespaces, prefixes, attributes, quote styles, CDATA and processing instructions stay visible.

04
Download valid XML

The result keeps every required close tag. If the input is unfinished or mismatched, it is returned untouched rather than guessed at.

Why XML needs its own minifier

XML and HTML share angle brackets but not parsing rules. XML names are case-sensitive, every ordinary start tag needs a matching end tag, attribute values stay quoted, and entity references such as & must not be casually rewritten. An HTML minifier can legally omit syntax that an XML parser will reject.

Whitespace is data unless there is good evidence that it is indentation. This tool removes formatted whitespace in element-only content, leaves mixed text beside child elements alone, and honours xml:space="preserve" through nested elements. CDATA, processing instructions, doctypes and the raw spelling of attributes are copied unchanged.

The output is still plain XML, not a compressed container. Files sent over the web should also use gzip or brotli, which normally saves much more because element and attribute names repeat throughout a document.

XML minification FAQ

Can XML be minified with an HTML minifier?

No, not safely. HTML permits void elements, omitted closing tags, unquoted values and case-insensitive names. XML permits none of those shortcuts, so this tool uses a separate tokeniser and copies every piece of tag syntax exactly.

Will whitespace inside text be removed?

No. A parent containing real text is treated as mixed content and its whitespace is left alone, including spaces beside child elements. xml:space="preserve" is also inherited. Only whitespace that has the shape of indentation in element-only content is removed.

What happens to CDATA and entities?

CDATA sections are copied byte for byte, and entity references keep their original spelling. The minifier never decodes & and writes it back another way, because external and document-defined entities may carry meaning it cannot infer.

Does it remove namespaces or prefixes?

No. Namespace declarations, prefixes and qualified attribute names are copied exactly as written. Removing or renaming them would require understanding every consumer of the document and is outside a conservative size pass.

What happens if the XML is malformed?

Mismatched or unfinished element structure is returned unchanged. The tool does not invent a close tag, drop a start tag or apply HTML recovery rules, because any of those would hide the original error behind a different document.

Drop more files

Same format joins the queue. Anything else re-routes to its own tool.