XML Minifier
Remove eligible XML indentation and copy the compact preview. This page starts in Minified mode on an element-only example. Mixed text such as Hello <b>world</b> ! stays as written, and comments, CDATA and simple declarations remain. Turn on Keep all text whitespace when spaces between elements may carry meaning in your document.
Multiline whitespace between child elements is rewritten unless kept above. Tag balance is checked; XML schema and full well-formedness are not validated.
Common questions
- What does XML minification remove here?
- Multiline whitespace used as indentation between child elements, outside protected regions. Comments are retained, attributes stay in their original order, and text-only leaves, mixed text, CDATA, inline child spacing and xml:space="preserve" regions remain as written. This is whitespace reduction, not ZIP compression or canonical XML.
- Why does some output still have line breaks?
- Real text can contain line breaks. Preserving a mixed-content or xml:space region also preserves any line breaks inside it, and comments or declarations may contain them too. Compact XML does not necessarily mean one line.
- Can I minify without changing any text whitespace?
- Use Keep all text whitespace. Elements with text tokens then remain intact, including their existing indentation. XML vocabularies can assign meaning to whitespace-only text, and this page has no schema that could prove a whitespace removal safe.
- How do I minify a file and save it?
- Copy the file contents into the input, inspect the preview and use Copy minified. Paste that into the target file in your editor. The page has no uploader or file download. A mismatched tag or unsupported DTD internal subset blocks output; full XML and XSD validity are not checked.
- Does it remove comments or load external entities?
- No. Comments remain and entities are not expanded or fetched. Simple DOCTYPE text is preserved; internal subsets are refused. Use a dedicated XML parser or schema validator when you need full well-formedness or validation.
Mixed text, text leaves, CDATA, inline child spacing and xml:space="preserve" regions are kept as written. Multiline whitespace between child elements may be rewritten unless Keep all text whitespace is selected. Checks cover tag balance and token boundaries, not full XML grammar or schema validity. DTD internal subsets are refused; nothing is fetched or expanded.