XML Formatter & Validator

Format, validate, and minify XML. Runs in your browser.

XML Input
Formatted Output
Formatted XML will appear here

About the XML Formatter

This XML formatter indents minified XML into a readable nested tree and checks that it is well-formed, reporting unclosed or mismatched tags. Useful for reading a SOAP response, an RSS feed or a sitemap that arrived as one long line.

An XML formatter makes nesting visible. SOAP envelopes, RSS feeds, sitemaps and configuration files are frequently transmitted with no whitespace at all, and XML's verbosity means a single line can run to thousands of characters with the structure completely hidden.

Well-formedness checking catches the errors that stop a parser dead: a tag closed out of order, a closing tag that never appears, an unescaped ampersand in text content, or two root elements. Because XML parsers refuse the whole document rather than recovering, knowing exactly where the problem is saves real time.

Note the distinction: this checks that the document is well-formed, not that it matches a schema. Well-formed XML can still be invalid against a DTD or XSD, which is a separate question.

How to use the XML Formatter

  1. Paste your XML. Drop in the minified or suspect XML.
  2. Check well-formedness. Any unclosed or mismatched tag is reported with its position.
  3. Format it. Produce an indented, readable tree.
  4. Copy the output. Take the formatted XML.

XML Formatter features

  • Syntax highlighting
  • Error detection
  • Indentation control
  • Validation
  • Minify option
  • Real-time formatting

Frequently asked questions

How do I format XML?

Paste your XML code and the formatter automatically indents and structures it properly.

Can the formatter fix XML errors?

The formatter validates XML syntax and highlights errors, but you'll need to fix structural issues manually.

What formatting options are available?

Choose indentation size, line wrapping, and other formatting preferences.