XML Minifier

Remove inter-element indentation from element-only XML.

Input

Processed on your device

How to use XML Minifier

Reduce structural spacing in readable XML to produce a smaller or single-line-style version where the content allows it.

  1. Paste XML and minify.
  2. Verify meaningful spaces inside paragraphs and any section that explicitly preserves whitespace before using the output.
Example input
<?xml version="1.0"?>
<inventory><item id="104">Notebook</item><item id="105">Pencil</item></inventory>

Example use

Compact a data feed sample so it fits more easily into a request example.

Output and compatibility

XML whitespace can carry meaning. The serializer preserves mixed text regions and respects space-preservation rules, so some line breaks can remain. A reserialization can affect signed content.

Troubleshooting

If the target expects exact bytes, retain the original. If malformed syntax stops the tool, validate the XML first.

Use XML Formatter for the readable form.

Frequently asked questions

Can I compact XML with inline tags inside sentences?

The formatter treats mixed text differently from element-only structure. Check the visible text after export.

Will it reduce every XML document to one line?

Some whitespace may be part of the actual content.

Find a tool