Worked example
This one-line message <note><to>Tove</to><from>Jani</from><body>Don’t forget me this weekend!</body></note> becomes:
<note> <to>Tove</to> <from>Jani</from> <body>Don’t forget me this weekend!</body> </note>
If the closing tag is mistyped, <to>Tove</from>, the checker stops with: line 2, column 11: Expected </to> (opened on line 2) but found </from>.
The errors people hit most
| XML | Problem | Message |
|---|---|---|
<a><b></a></b> | Tags closed in the wrong order | Expected </b> (opened on line 1) but found </a>. |
<item id=5/> | Attribute value without quotes | The value of “id” must be in quotes. |
<p>Fish & chips</p> | A bare & in text | A bare “&” must be written as & (or start an entity like <). |
<a x="1" x="2"/> | The same attribute twice | Attribute “x” appears twice in <a>. |
<a/><b/> | Two root elements | A second root element <b>. An XML document has exactly one root element. |
XML rules in brief
- Names are case-sensitive: <Item> and <item> are different elements.
- Names can’t start with a digit, a hyphen or a dot, and can’t contain spaces.
- Empty elements can be written <br/> or <br></br>.
- Only five entities are built in: & < > " '. Others, like , need a DTD; use the number form   instead.
- The <?xml version="1.0"?> declaration is optional, but if present it must be the very first thing in the file.
Related tools
- URL encode and decode
- Colour converter
- SQL formatter
- CSS gradient generator
- Box shadow generator
- HTML and CSS minifier
- Meta tag analyzer
- Colour palette generator
- Contrast checker
- JSON to CSV
Sources
Checked on November 26, 2026:
Frequently asked questions
What does “well-formed” mean?
That the XML follows the basic syntax rules: exactly one root element, every tag closed and properly nested, attribute values in quotes, no repeated attributes, valid names and & used only for entities like &. Any XML parser must reject a document that breaks these rules.
Is this a schema validator?
No. It checks well-formedness, not whether the elements match a DTD or XML Schema (XSD). A document can be well-formed and still be invalid for a particular format.
Why does my file fail on an ampersand?
In XML, & starts an entity. Write it as & in text and attribute values, or wrap the text in a CDATA section, .
Can it format SVG, RSS and sitemap files?
Yes. They are all XML. Open the file or paste it in; CDATA, comments and processing instructions are kept as they are.
Does pretty printing change the data?
It removes whitespace-only text between tags and adds indentation. For most data formats that is harmless, but where whitespace inside mixed content matters (such as xml:space="preserve"), compare the output before using it.
Is my XML uploaded?
No. It is checked and formatted on your device, which matters for configuration files with keys and passwords.
Last updated: 2026-11-26