Dad’s Data formats tools

XML Minifier

Remove all whitespace and comments from XML for compact output. Namespace prefixes are preserved.

XML Input
Minified XML

Minified XML will appear here

Paste XML in the input panel to get started.

What minification does

XML minification removes all insignificant whitespace — indentation, newlines, and spaces between elements — and strips comments. The result is semantically identical to the original but occupies the minimum possible bytes, making it ideal for wire transfer and storage.

Input
<?xml version="1.0" encoding="UTF-8"?>
<!-- Server config -->
<config>
  <server>
    <host>localhost</host>
    <port>8080</port>
  </server>
</config>
Output
<?xml version="1.0" encoding="UTF-8"?><config><server><host>localhost</host><port>8080</port></server></config>

What is preserved vs stripped

XML constructAfter minificationNotes
Element content (text)PreservedText nodes kept exactly as-is
AttributesPreservedIncluding whitespace in values
Namespace declarationsPreservedRequired for valid XML
Processing instructionsPreservede.g. <?xml-stylesheet?>
Indentation / newlinesStrippedBetween elements only
XML commentsStripped<!-- --> blocks removed
CDATA sectionsPreservedContent is significant
Whitespace in text nodesPreservedUser content may be space-sensitive
Note: Whitespace inside text nodes (i.e. between tags that contain actual text) is always preserved — stripping it would change the document's meaning. Only inter-element whitespace (pure indentation) is removed.

When to minify

Minification is most valuable when XML is transmitted over a network (REST APIs, SOAP payloads, RSS feeds) or stored in space-constrained environments. Well-formatted XML typically achieves 20–60% byte reduction through minification alone. Combine with gzip compression for maximum reduction — XML compresses very well due to tag repetition.

Warning: Do not minify XML that is used as a configuration file edited by humans, or XML that will be diff-compared in version control — the result is a single unreadable line that makes reviews and debugging very difficult.

Frequently Asked Questions

Your files stay on your computer. Dad promised.

Data formats tools

Search the Data formats tools