XML Formatter & Validator
Format, minify and check XML in your browser. Mismatched tags, unquoted attributes and unescaped characters are reported with line and column.
Runs in your browser. Nothing is uploaded.
About the XML Formatter & Validator
XML is still behind many everyday files and integrations: RSS and Atom feeds, sitemaps, SVG images, Office documents, Android layouts, SOAP APIs and countless configuration formats. Unlike HTML, XML must be well-formed, so a single unescaped ampersand or mismatched tag makes the whole document unreadable to a parser.
Formatting indents the element tree so you can read it, and the checker reports the first well-formedness error with its line and column. Minify removes whitespace between tags for compact storage or transmission, while keeping text content as written.
How to use the XML Formatter & Validator
- 1
Paste your XML, open a file (.xml, .svg, .rss and more), or load the sample. Pasting, opening a file or loading the sample runs it automatically.
- 2
Choose an indent size.
- 3
Press Format to indent it, Minify to remove whitespace between tags, or Validate to check it without changing the output.
- 4
If the XML is not well-formed, the error shows the line and column. Fix it and run again.
Examples
<order id="7"><item sku="A1">Pen</item><item sku="B2">Paper</item><note/></order><order id="7">
<item sku="A1">Pen</item>
<item sku="B2">Paper</item>
<note/>
</order><order><item>Pen</order>Error on line 1, column 18: expected </item> but found </order>.Good to know
- This checks that XML is well-formed: balanced tags, one root element, quoted and unique attributes, escaped “<” and “&”. It does not validate against a DTD or XML Schema (XSD).
- Formatting trims whitespace at the start and end of text, and puts text in mixed content (text next to child elements) on its own line. If spacing inside text matters, use Minify, which keeps text exactly as written.
- Attributes stay on the same line as their tag.
Frequently asked questions
Can I format SVG or RSS files?
Yes. SVG, RSS, Atom and plist files are XML, so they can be formatted and checked here.
Why is “&” reported as an error?
In XML a bare “&” starts an entity such as & or ©. Write & for a literal ampersand, or wrap the text in a CDATA section.
Is my code uploaded to a server?
No. Processing happens entirely in your browser, in a background thread. Your input is never sent to our servers or stored anywhere.
Related tools
More tools that pair well with this one.