XML sits behind sitemaps, RSS feeds, configuration files and many older APIs. One mismatched tag and a parser refuses the whole file.
What the formatter does
Paste XML into the XML Formatter and it parses the document with your browser’s own XML parser. If it is well-formed, the tool re-indents it with two or four spaces, so <root><a>1</a><b><c>2</c></b></root> becomes a readable nested layout. If it is not, you get an “Invalid XML” message from the parser with the line and column, for example “error on line 1 at column 15: Opening and ending tag mismatch: a line 1 and b”. Text inside an element is placed on its own indented line.
What well-formed means
- There is exactly one root element.
- Every opening tag has a matching closing tag, in the right order:
<a>1</b>is an error. - Attribute values are in quotes.
- Special characters in text are escaped:
&for an ampersand and<for a less-than sign. - Tag names are case-sensitive, so
<Item>and<item>differ.
Using the tool
- Paste your XML.
- Choose a two- or four-space indent.
- Read the formatted output, or the error, and copy or download the result.
Well-formed is not the same as valid
The tool checks structure only. It does not check the document against a schema (XSD) or a DTD, so it cannot tell you whether the element names or order are what a given system expects. A sitemap can be well-formed and still be rejected by a search engine for a wrong field.
Careful with whitespace
Re-indenting adds whitespace between elements. In most data files that is harmless, but in documents where spaces inside text matter, check the result before replacing the original.
Frequently asked questions
Does it work on HTML?
Not reliably. HTML allows unclosed tags that XML does not, so ordinary web pages often fail. Only XHTML or XML-style markup passes.
Is my XML uploaded?
No, it is parsed locally in your browser.