XML Formatter

Format and validate XML online for free with proper indentation, in your browser.

How to use

  1. 1Paste your XML into the editor.
  2. 2Click Format to beautify it, or Minify to compact it.
  3. 3Copy or download the result.

Features

  • Format with proper indentation
  • Minify to a single line
  • Validates XML while formatting
  • Copy or download the result

Supported formats

XML

Privacy

Your XML is processed locally in your browser and is never sent to our server.

About this tool

The XML Formatter beautifies XML with consistent indentation using your browser's built-in DOMParser to first confirm the document is well-formed, then re-serializes it with one tag per line and nested elements indented under their parent. Minify does the reverse, stripping whitespace back down to a single compact line for sending over the wire. Looking for a JSON equivalent instead? See the JSON Formatter, or read our guide on JSON vs XML.

Frequently asked questions

Does this validate my XML too?

Yes, Format and Minify both check that the XML is well-formed first and show an error if it is not.

Is my XML sent to a server?

No, formatting happens entirely in your browser using the built-in DOMParser.

Why bother formatting XML instead of leaving it minified?

Minified XML from an API response or config export is often one unbroken line with no visual nesting, which makes it hard to tell which closing tag belongs to which element. Indentation makes the document's actual structure visible at a glance.