RUNWEBTOOLS
English

XML Formatter

Beautify and indent XML, and flag mismatched tags — in your browser.

Live — formats as you type

Examples

Beautify minified XML

Input

<root><item>One</item><item>Two</item></root>

Output

<root>
  <item>One</item>
  <item>Two</item>
</root>

Catch a mismatched tag

Input

<a><b></a>

Output

Mismatched closing tag </a> — expected </b>.

About this tool

This free online XML formatter turns messy or minified XML into a clean, neatly indented tree — a fast XML beautifier and pretty-print tool that also flags mismatched or unclosed tags. Paste your XML, choose an indentation style, and the formatted result appears instantly. Everything runs in your browser with no upload, so your data never leaves your device.

How to use

  1. Paste your XML into the input box (or click Sample to try it).
  2. Pick an indent of 2 spaces, 4 spaces, or a tab.
  3. Read the beautified XML in the output box on the right.
  4. Copy the result with the Copy button.

When to use an XML formatter

Reformatting helps when you work with SVG, RSS feeds, sitemaps, SOAP responses, or config and data files that arrive as a single dense line. Indentation by nesting depth makes the structure obvious and broken nesting easy to spot.

Frequently asked questions

Is this XML formatter free?

Yes — it's a completely free online XML formatter and beautifier with no sign-up and no limits. Format and indent as much XML as you like.

Is my XML uploaded to a server?

No. This is a no-upload tool — your XML is formatted entirely in your browser, so the data never leaves your device. It's safe for private or internal files.

What does the XML beautifier do?

It puts each element on its own line and indents by nesting depth, turning minified or single-line XML into a clean, readable tree.

Does it check that my XML is well-formed?

Yes, at a structural level: it flags mismatched closing tags and unclosed tags so you can spot broken nesting. It is not a full schema or DTD validator.

Can I choose the indentation?

Yes — pick 2 spaces, 4 spaces, or tabs. Your choice is remembered in your browser for next time.

Does it handle declarations, comments, and CDATA?

Yes. XML declarations (<?xml ?>), comments, DOCTYPE, and CDATA sections are preserved and placed on their own lines without affecting indentation.

Does it work offline and on mobile?

Once the page has loaded it runs locally, so it keeps working on a flaky connection, and the layout is fully responsive on phones and tablets.

Learn more

Related tools