XML Minifier
Strip comments and whitespace from XML in one click — with validation, size savings, and one-click beautify.
XML
Waiting for XML…
What this tool does
Paste XML — API payloads, config files, SVG markup — and hit Minify to strip comments and collapse the whitespace between tags in place, with the percentage saved shown in the status bar. Beautify goes the other way when you need to read it. The document is validated as you type with the failing line underlined in the editor. Everything runs in your browser.
How to use it
- Paste your XML into the editor — or hit Upload to open an
.xml,.svg, or.htmlfile from your machine. - Click Minify to strip comments and whitespace in place — the status bar shows the size and the percentage saved.
- Click Beautify whenever you want the document re-indented for reading — it acts on the same editor.
- Copy the result, or Download it — the file follows the active mode:
.min.xmlafter Minify,.xmlotherwise.
Frequently asked questions
Is my XML uploaded anywhere?
No. Validation and minification run entirely in your browser. Nothing is sent to a server, logged, or stored.
How much smaller does minified XML get?
It depends on how much indentation and how many comments the input carries — a typical pretty-printed document shrinks by 10–30%. The status bar shows the exact size and the percentage saved after minifying.
Does minifying change the data?
The element structure, attributes, and text values stay intact — comments are removed and the formatting whitespace between tags is stripped. Runs of whitespace inside text content are also collapsed to a single space, so double-check documents that rely on significant whitespace (e.g.
xml:space="preserve").Are XML comments removed?
Yes — every
<!-- comment --> is stripped as part of minifying. If you need them back for reading, Beautify re-indents the document but cannot restore comments that were already removed.What happens when the XML is invalid?
The status bar turns red and names the failing line along with the reason — an unclosed tag, a mismatched closing tag, a stray ampersand — the same line is underlined in the editor, and Minify/Beautify are disabled until it parses.