XML Formatter

Format and validate XML documents with consistent indentation.

This tool runs entirely in your browser. The file you choose is never uploaded to a server. Free, with no account required.

Input
XML text
Output
Formatted XML
Category
Developer Tools
Status
Available now
Price
Free — no subscription, no account

How to use XML Formatter

  1. Paste XML into the editor.
  2. Leave well-formedness checking on to catch mismatched tags before formatting.
  3. Choose an indent size.
  4. Copy or download the formatted or minified result.

Frequently asked questions

What does the well-formedness check do?

It runs the document through the browser's own XML parser and reports the parser's message when it fails. Turn it off if you are formatting a fragment rather than a complete document.

Why did my mixed content get split across lines?

An element whose entire content is text stays on one line. Mixed content such as <p>Hello <b>world</b></p> is broken across lines, which adds whitespace between the words. That is harmless for data XML but visible in XHTML, so the tool says so rather than pretending it did not happen.

Is whitespace inside pre or script preserved?

Yes, during minification. Those four elements — pre, textarea, script and style — keep their whitespace exactly.

Does it validate against a schema?

No. It checks well-formedness only. Schema or DTD validation is a different job and is not attempted here.

Related tools