About the XML Minifier
Indented XML is easy to read but every space and newline is transmitted, stored and parsed. This minifier removes whitespace between elements, collapses whitespace inside tags to single spaces, and drops comments unless you tick the option to keep them. CDATA sections and attribute values are copied byte for byte, because whitespace inside them is data.
The parser check runs first, so you cannot minify a document that would fail to load elsewhere. Typical savings are 15 to 35 percent for configuration files and considerably more for generated documents with deep indentation. The stats line reports the exact byte reduction for your input.
Use it for SVG icons that will be inlined in HTML, for XML payloads sent from mobile clients, or to fit an XML fragment into a single-line configuration value. If you later need to read the file again, the XML Formatter restores the indentation.
How to use
- Paste or upload the XML.
- Tick Keep comments if the comments carry licence text or instructions you need to keep.
- Copy the single-line result or download it.
Common questions
- Is whitespace inside text content removed?
- Leading and trailing whitespace around text is trimmed and inner runs collapse to one space. Text inside CDATA is not touched.
- Does it remove the XML declaration?
- No. The
<?xml ... ?>declaration and any processing instructions stay in place. - Can it minify SVG files?
- Yes, and it is a safe first step. Dedicated SVG optimisers go further by simplifying paths, which this tool does not do.