XML Minifier
Compress your XML by removing whitespace, comments, and unnecessary formatting instantly.
Minified output will appear here...About XML Minifier
XML Minifier is a free online tool that compresses XML documents by stripping whitespace between tags, collapsing redundant line breaks, and optionally removing comments. The resulting output is a single-line, parser-identical XML document that takes up significantly less space — typically 30 to 60 percent smaller than the formatted original — while preserving every element name, attribute, and text value exactly.
Minification is most useful right before your XML leaves your development environment: when embedding a configuration file in a build artifact, when publishing a SOAP or REST payload, when inlining an SVG inside HTML, or when storing XML in a database column where byte count matters. The tool also shows a live character-savings percentage so you can see the impact before committing the output.
Every minification step runs entirely inside your browser. No data is sent to any server, logged, or cached — paste a production config file or a document containing sensitive values and it stays on your own machine. There is no file size cap, no account required, and no cost.
Key Features
Optional comment removal
A single checkbox controls whether XML comments are stripped. Leave it on to shrink the file further; turn it off when comments carry machine-readable metadata you need to keep.
Whitespace-only compression
Whitespace between tags is removed and multiple consecutive spaces are collapsed to one, so tag names, attributes, and text nodes are never touched.
File upload and download
Upload any .xml, .svg, or .txt file directly from disk, minify it, then download the result as minified.xml — no copy-paste required for large files.
Live size-savings display
After minifying, a stats bar shows the original character count, the minified count, and the percentage saved so you can confirm the compression is worthwhile.
Works with SVG files
SVG is XML-based, so the minifier handles .svg files correctly. Strip the design-tool whitespace and comments before inlining SVG into HTML or bundling it in a sprite sheet.
100% client-side processing
All regex and string operations run in your browser tab with no network request. Sensitive configuration files, API credentials embedded in XML, and internal schemas never leave your machine.
How to Use
Paste Your XML
Copy your formatted XML and paste it into the input editor on the left.
Minify
Toggle comment removal if needed, then click "Minify" to compress your XML.
Copy the Result
Review the size savings, then copy the minified XML or download it as a file.
Example
Indentation, line breaks, and comments are removed. Tag names, attributes, and text content are preserved unchanged.
<?xml version="1.0" encoding="UTF-8"?>
<!-- App feature flags -->
<features>
<feature name="dark-mode" enabled="true" />
<feature name="beta-api" enabled="false" />
<feature name="notifications" enabled="true" />
</features> <?xml version="1.0" encoding="UTF-8"?><features><feature name="dark-mode" enabled="true"/><feature name="beta-api" enabled="false"/><feature name="notifications" enabled="true"/></features> Common Use Cases
- arrow_circle_right
Reducing config file size in build artifacts
Application config files written in XML (web.config, pom.xml, AndroidManifest.xml) often contain developer comments and generous indentation. Minifying before packaging shrinks the artifact and speeds up deployment without changing how the runtime reads the file.
- arrow_circle_right
Compressing SOAP payloads before sending
SOAP web services exchange large XML envelopes. Minifying the request or response body reduces bandwidth and can noticeably lower latency on high-volume integrations, especially when the XML structure is deeply nested.
- arrow_circle_right
Inlining SVG into HTML pages
SVGs exported from design tools carry editor comments, empty groups, and indentation. Minifying the SVG before inlining it inside an HTML file cuts page weight and keeps the markup tidy.
- arrow_circle_right
Storing XML in database columns
When XML is saved to a VARCHAR or CLOB column, whitespace inflates the stored value for no benefit. Minifying before INSERT keeps row sizes down and makes index-based searches faster.
- arrow_circle_right
Preparing XML data feeds for production APIs
RSS feeds, sitemap.xml files, and Atom feeds are fetched repeatedly by crawlers and aggregators. Serving minified XML reduces bytes transferred per request and lowers CDN egress costs.