XML Formatter & Minifier

Pretty-print XML with indentation, or compact it to one line. This tool beautifies and minifies XML on one page — paste your code, pick a mode, and click. Everything runs on your device, nothing is sent to a server.

The result will appear here…
or press Ctrl+Enter

Everything runs in your browser. Your code is never sent to our servers.

728 × 90Ad Space AvailablePlace your ad here

Example

Example Input

<a><b>1</b><c>2</c></a>

Example Output

<a>
  <b>1</b>
  <c>2</c>
</a>

How to Use

  1. 1Choose Format or Minify mode at the top.
  2. 2Paste your XML code into the Input field.
  3. 3If needed, set the indent width in "More settings".
  4. 4Click the button (or press Ctrl+Enter) to process. The result appears in the Output field.
  5. 5Click Copy to copy the result.

About the XML Formatter

The XML Formatter prettifies XML documents with nested indentation so the element hierarchy is clear, or compacts it by removing whitespace between tags.

How it works: the tool parses the XML structure then rewrites each element on its own line indented to its depth. Minify strips whitespace between tags.

XML is used in configuration, SOAP, RSS, SVG, and many document formats. Formatting it makes deep, complex structures easier to read and debug.

FAQ

Can this XML tool both format and minify?

Yes. One page with a toggle — Format mode prettifies (beautifies) with indentation, and Minify mode compacts it. No need for two separate pages.

Is my code sent to a server?

No. XML is processed entirely in your browser using JavaScript/WebAssembly. Your code never leaves your device.

Related Tools

Related Categories