Data & Code

XML Minifier

Validate XML and remove formatting-only whitespace.

Read the guide

Run the tool

The calculation runs in your browser. This tool does not send your input to JVR Software.

More information

Back to the tool

What it is and when to use it

XML Minifier produces a more compact representation of an XML document by removing whitespace between tags. It is useful for machine-oriented XML where indentation is for human readers and you already know that spacing between elements does not carry meaning.

How it works

The browser parses and serialises XML, then strips whitespace between adjacent markup boundaries. Text inside an element is different from indentation outside that text. In mixed-content documents, whitespace between inline elements can be part of the intended text.

How to use it

  1. Paste the full XML document.
  2. Preview the compact result and compare it with your intended structure.
  3. Use a copy for testing with the receiving application before replacing a configured or published file.

Worked example

An indented list with <items> and nested <item> elements can be compacted to a single line. By contrast, in <p><b>One</b> <i>two</i></p>, the space between inline elements makes a difference to the displayed sentence.

Reading the result

If a result disappears into one long line, that can be the expected outcome. Check content type, namespace declarations and expected values in a separate parser when the document is sensitive to layout. The minifier is not a compression algorithm.

Common mistakes and limits

Avoid this tool for signed XML, documents with meaningful whitespace, code examples inside XML, or material that must compare byte-for-byte with the original. Preserve the original source before minifying.