Skip to content

XML Minifier

Minify XML by removing indentation, line breaks between tags and comments while keeping elements, attributes, text content and CDATA exactly as they are. The minifier checks that the document is well formed first and reports mismatched tags or broken attributes with line and column. It respects xml:space="preserve", so developers can shrink feeds, sitemaps and payloads safely.

Reset

Frequently asked questions

What does the XML minifier remove?

It removes whitespace-only text between tags, comments and extra spaces inside tags between attributes. Text that contains any visible character stays exactly as written.

Can I keep comments?

Yes. Turn on Keep comments and every comment stays in the output. By default comments are removed because they rarely matter to machines.

Is whitespace inside xml:space="preserve" kept?

Yes. Inside an element with xml:space="preserve", and its children unless they reset it, all whitespace text is kept unchanged.

Does it check the document first?

Yes. Mismatched or unclosed tags, duplicate or unquoted attributes, text outside the root element, several root elements and stray & characters are reported with the line and column.

What happens to CDATA, processing instructions and the DOCTYPE?

They are kept as written. The XML declaration stays first, with extra spaces inside it collapsed.

Will entity references be expanded?

No. References such as & or © stay as they are, so the minified document means exactly the same as the original.

Can removing whitespace change meaning?

In mixed content, whitespace-only text between two inline elements is removed, which can join words like <b>a</b> <i>b</i>. Use xml:space="preserve" or keep such documents formatted if that matters.

How large can the input be?

Up to 1 MB of XML per request. The minifier reads the document in one pass, so results come back quickly.

Can I minify SVG files with it?

Yes, SVG is XML. For much smaller SVG files, the SVG Minifier also optimizes paths, colors and numbers with SVGO.

Is my XML stored?

No. The document is processed in memory and returned. It is never saved and only request sizes are logged.

About OneClick Pro

OneClick Pro is a free collection of more than 150 web tools for everyday work: converting images and units, formatting and validating code, checking domains and SEO, and working with text, dates and numbers. Every tool runs without registration or subscription, and what you enter is only used to calculate your result and is never stored. Use it as a quick toolbox for one-off tasks, or bookmark the tools you rely on every day.