How to use it
- Paste the XML into XML document. The browser checks it as you type.
- Choose an Output: an indented layout, or Minified, one line to make the text as short as possible.
- If the check names a line and column, fix the text there. Nothing is formatted until the document is well-formed.
- Copy the Result, or download it as formatted.xml.
What a well-formed document needs
XML 1.0 is strict. A document has exactly one root element. Every element that is opened is closed in the right order, so an element opened inside another must close before the outer one does. Attribute values are in single or double quotes, and a value cannot contain the less-than sign. Each ampersand starts a reference that exists, such as & or &; a name such as is an error unless the document declares it.
The checker follows the XML 1.0 specification of the W3C, and the browser's own XML parser gives the message. When the browser gives no position, the tool finds the line itself.
- Indented output puts each element on its own line and keeps text, CDATA sections, comments and processing instructions as they are.
- Minified output removes the white space between tags. Text inside an element is kept, and so are the spaces of mixed content such as a paragraph with a bold word in it.
What the formatter keeps and what it does not change
Attribute order, attribute quotes and the references inside values are kept as written. The XML declaration and a DOCTYPE stay at the top. Comments and CDATA sections are not changed, because their content is data.
Entities declared in a DOCTYPE are not expanded by this formatter; a document that depends on them is reported as not formattable here. Namespace prefixes are read as part of the name and are not checked against their declarations.
Worked example: the sample shop feed
The page starts with a short shop feed: a declaration, a comment, a shop element with a name attribute holding Lale & Co, two products and a CDATA section inside the first one. Indented with two spaces, each product starts on its own line and the price stays on one line with its text.
Minified, the same feed is one line of text. The CDATA section and the comment come out exactly as they were written, and the self-closing product stays self-closing.
Frequently asked questions
Why is my XML reported as not well-formed when it looks right?
The usual causes are a closing tag that does not match its opening tag, an ampersand that is not written as &, and an attribute value without quotes. The reported line and column show the first place where the document breaks the rules.
Does the formatter check the document against an XSD or a DTD?
No. It checks that the document is well-formed, which is the first rule of XML. Validation against a schema needs the schema file, and it is a separate step that this page does not do.
Can I minify an XML document without changing its meaning?
Usually yes. Removing the white space between tags does not change the elements, the attributes or the text. White space inside text is kept, so the only change is the layout.
Why do CDATA sections and comments stay as they were?
A CDATA section holds text that the reader takes as it is, and a comment is not part of the data. The formatter leaves both unchanged so that their content is never reformatted.
Is my XML sent to a server?
No. The check and the formatting run in your browser. Nothing you paste is sent to our server or stored there.
Sources
Figures and text last checked on Tuesday, November 10, 2026.