Developer Tools Runs in your browser Free · no account

XML Formatter

The XML formatter re-indents an XML document with consistent nesting, keeping attributes, CDATA sections and comments intact. It reports parse errors with their position so malformed documents are easy to fix.

Options
XML 0 characters
Formatted XML

Your result will appear here.

Not sure where to start? Use Load example.

Results update automatically and are calculated on your device. Nothing you type is sent to a server.

Runs in your browser. Processing happens entirely in your browser. Nothing you enter is sent to Delimiter.live.

How to use the XML Formatter

  1. Paste an XML document, an SVG file or any XML-based format.
  2. Choose an indent width.
  3. Copy or download the formatted document.

Example

Input
<a><b>1</b></a>
Output
<a>
  <b>1</b>
</a>

Common use cases

  • Reading a minified SOAP response or a compressed configuration file.
  • Tidying a hand-written XML document before committing it.
  • Inspecting an SVG file to find the element you need to edit.

Limitations and things to watch for

  • Whitespace inside mixed content — text and elements in the same parent — is significant in XML, so those elements are left on one line rather than being re-indented and altered.
  • The XML declaration, comments, processing instructions and CDATA sections are preserved as written.
  • Parsing uses the browser DOMParser, which never resolves external entities or fetches DTDs.

Frequently asked questions

Will formatting change the meaning of my document?
No. Only whitespace between elements is changed, and elements containing mixed content are left untouched precisely because whitespace matters there.
Can I format SVG files?
Yes. SVG is XML, so it formats correctly and the result is still a valid SVG.
Is it safe against XXE?
Yes. The browser parser does not resolve external entities and makes no network requests.

Share this tool