XML Minifier
Remove the whitespace between tags to shrink an XML document, with a size saved readout. Attribute values, CDATA, and preserved content are left untouched.
Validated and minified live as you type. Nothing leaves your browser.
Options
Empty elements
How to minify XML online
Paste your XML
Drop an XML document or fragment into the input and the minified version appears immediately below.
Check the savings
The size before and after and the percentage saved are shown, so you can see exactly what the whitespace was costing.
Copy the result
Use Copy XML to grab the compact document and paste it into a request body, a test fixture, or a config file.
Why use this tool
Remove the whitespace between tags
Strips the indentation and line breaks between elements and collapses runs of whitespace inside text, then reports the size before and after.
Content stays intact
Attribute values, CDATA sections, and any element marked xml:space="preserve" are copied through byte for byte, so meaningful whitespace is never lost.
Validates before it minifies
The document is checked for well-formedness first, so malformed markup shows the real parse error instead of a broken, half-minified result.
Comments, empty tags, and preserve rules
Keep or strip comments, collapse empty elements to self-closing tags, and name extra tags such as pre or code whose whitespace must be kept.
Size saved readout
Shows the size before and after minifying plus the percentage saved, so the smaller document is easy to justify.
Runs entirely in your browser
Everything happens on your device. The document you paste, including any internal endpoints or account data, is never uploaded.
About this tool
This XML minifier shrinks a document by removing the whitespace that only exists for humans: the indentation and line breaks between elements, and the runs of spaces and tabs that pad the markup. Whitespace-only text between tags is dropped entirely, runs of whitespace inside text are collapsed to a single space, and the size before and after is reported with the percentage saved. Paste a document and the compact version appears instantly, so shrinking a payload is paste, glance at the savings, copy.
The minification is careful about what counts as content. The document is validated for well-formedness first, so broken markup shows the real parse error rather than a half-minified result. Attribute values are kept exactly, CDATA sections are copied through untouched, and any element carrying xml:space="preserve" keeps its whitespace, as do tags you name yourself such as pre or code. You can keep or strip comments and collapse empty elements like <br></br> into <br/>, but entities, text, and structure are never rewritten.
Reach for it when an XML payload arrived as one bloated, indented blob and you need it compact for a request body, a test fixture, or an inline snippet, or when you simply want to see what the whitespace was costing. When you need the document readable again, the XML formatter pretty-prints and validates it, XML to JSON reshapes a valid document for scripting, and the JSON minifier does the same shrinking job for JSON. Everything runs in your browser, so config files and integration payloads never leave your device.
Frequently asked questions
- What does minifying actually remove?
- The whitespace between tags: indentation, line breaks, and the runs of spaces and tabs that pad the markup. Runs of whitespace inside text are collapsed to a single space. Attribute values, CDATA sections, comments you choose to keep, and the structure of the document are left exactly as they were.
- Will minifying change my data?
- No. The document is validated first, then only insignificant whitespace is removed and runs are collapsed. Attribute values and CDATA are copied byte for byte, and any element marked xml:space="preserve" or listed in the preserve field keeps its whitespace, so meaningful content is never altered.
- What happens when my XML is invalid?
- The parse error is shown inline, typically with the line and column where parsing stopped, so unclosed tags and mismatched nesting are easy to find. Nothing is minified until the document is well-formed, and your input stays untouched while you fix it.
- Can I keep whitespace in certain tags?
- Yes. Elements marked xml:space="preserve" are always respected, and you can name extra tags such as pre or code whose contents should be left untouched. Comments can be kept or stripped, and empty elements can be collapsed to self-closing tags.
- Is my XML uploaded anywhere?
- No. Everything runs in your browser and the document never leaves your device, which matters when the XML belongs to a client project or an internal integration. Very large files are bounded by your device memory since everything runs in the tab.
Related tools
XML Formatter & Validator
Pretty-print, minify, and validate XML, with the parse error shown inline.
XML to JSON
Paste XML and get JSON instantly, with attributes kept or ignored, indent control, and errors that point at the line.
JSON Minifier
Minify JSON to the smallest single line, with original vs minified byte size and the percentage saved.
API Key Generator
Generate cryptographically random API keys and tokens in hex, base62, or base64url, with control over length, an optional prefix, and bulk output.
ASCII Table Reference
The full ASCII character set with decimal, hex, octal, binary, and HTML codes. Search by code, character, or name.
Atbash Cipher
Mirror the alphabet so A swaps with Z, B with Y, and so on. Atbash is its own inverse, so one field both encodes and decodes as you type.