XML Minifier
Shrink XML files such as feeds, SVG icons, configuration or SOAP payloads by removing the indentation between tags and, if you want, comments. The document is checked for well-formedness first, and anything that carries meaning, like attribute values, CDATA sections and xml:space="preserve" content, is copied exactly.
Minify Your XML
Where the error is
Minified XML
Size
How to Use the XML Minifier
- Paste your XML.
- Choose whether to remove comments, shorten empty elements, collapse spaces in text and drop the XML declaration.
- Press Minify.
- Copy or download the result and check the size saving.
About This Tool
Developers reducing payload sizes, people embedding XML or SVG in code, and anyone who needs a document on a single line.
Input: XML · Output: Minified XML (.xml).
Features and Limitations
Features
- Validates first and points to the exact line and column of any error.
- Keeps CDATA, processing instructions, DOCTYPE and xml:space="preserve" content unchanged.
- Optional comment removal and <a></a> to <a/> shortening.
- Shows original and new size with the percentage saved.
Limitations
- Whitespace-only text between tags is removed. In the rare documents where that whitespace matters, mark the element with xml:space="preserve".
- Attribute values and namespace declarations are not shortened.
- Removing the XML declaration changes the assumed encoding to UTF-8.
- Results are computed in your browser; nothing you enter is sent to a server.
Frequently Asked Questions
Is minified XML still valid?
Yes. Only insignificant whitespace and, optionally, comments are removed, so any XML parser reads the same data.
What is the difference from the XML Formatter's minify mode?
This tool adds options to shorten empty elements, collapse spaces inside text and drop the declaration, and it reports the size saving.
Will it break my SVG?
No. SVG is XML, and attribute values such as path data are copied exactly.
Is the XML uploaded?
No. Everything runs in your browser.
Related Tools
More like this: all Format & Validate tools, all Developer & Web tools or the TinySandy home page.