XML Minifier
Paste XML to strip all inter-element whitespace and comments, producing a compact single-line output with original vs. minified byte sizes.
XML Input
Minified Output
Paste XML on the left and click Minify XML.
Original
bytes
Minified
bytes
Saved
Valid XML
Copied!
Summary
Paste XML to strip all inter-element whitespace and comments, producing a compact single-line output with original vs. minified byte sizes.
How it works
- Paste your XML into the input area. The tool parses it using the browser's native DOMParser to validate well-formedness, then serializes it with XMLSerializer, strips all inter-element whitespace text nodes, removes XML comments, and collapses the result to a single compact line. Byte counts are calculated via TextEncoder for correct multi-byte Unicode handling.
Use cases
- Reduce XML payload size for REST or SOAP API requests and responses.
- Compress configuration or data files before embedding in build artifacts.
- Strip comments and formatting from XML before sending to production.
- Quickly measure how much whitespace and comments bloat an XML document.
- Minify SVG or XHTML files to reduce page-load size.
- Prepare compact XML for storage in databases or environment variables.
Frequently Asked Questions
Last updated: 2026-06-09 ·
Reviewed by Nham Vu