Check XML is well formed and see exactly where it breaks
Runs in your browser. Nothing you type is sent anywhere. Updated on 24 Oct 2026.Something is rejecting your file and the only clue is "invalid XML". Paste it here to see the first real problem with its line and column: a tag closed by the wrong name, an attribute value missing its quote, a bare ampersand, a comment that never ends, or two root elements. Each one comes with what to change, not a parser dump.
The page opens in Validate mode; paste the document into the XML box.
Read the result: Well formed, or Not well formed with the line and column of the first problem.
Follow the hint under the box, fix the input and watch the result change.
Once it is well formed, read the root element, element and attribute counts and the deepest nesting.
This XML formatter does three jobs from one box. Format indents the document as a tree, one element per line, at two spaces, four spaces or a tab. Validate checks that the document is well formed and, when it is not, gives you the first real problem with its line and column. Minify strips the indentation and, if you want, the comments, and shows the bytes saved.
XML tends to arrive in an awkward state. A SOAP response or an API payload is one line thousands of characters long. A feed from a partner is rejected by your importer with nothing more than "invalid XML". A config file has been edited by three people and no longer lines up. All three are a paste away from readable here.
The validator checks what XML actually requires: one root element, every tag closed by its own name in the right order, attribute values in quotes and never set twice, ampersands written as entities, and nothing but whitespace and comments outside the root. Messages say what to change, such as which element was opened earlier and has to be closed first. It does not check against a DTD or an XSD schema; it checks that the document is well formed, which is the failure people actually hit.
The rest of the article, and all 6 questions about XML Formatter & Validator, are on the XML Formatter & Validator page.
Paste it and the first problem is shown with its line and column, next to the input. Typical answers are a tag closed by the wrong name, an attribute value missing its quote, a bare ampersand that should be &, or a second root element.
No. It checks that the document is well formed: one root, correctly nested and closed tags, quoted attributes and valid entities. Schema validation needs the schema itself and is a different job. Well-formedness is what most rejected files actually fail.
No. Only whitespace between elements is removed, because that is indentation a formatter added. Text inside an element is the data, so it is copied exactly, and CDATA sections are left untouched. Comments are removed unless you keep them.
Yes. Both are ordinary XML. Paste the whole response, including the XML declaration, and it comes back as an indented tree. Namespace prefixes such as soap: and content: are element names like any other and are preserved.
Still stuck? Ask about XML Formatter & Validator and anybody who knows can answer. No account needed.
Same job, other tools: GraphQL Validator – Check a GraphQL query or schema for errors, optionally against your own SDL · JSON Validator – Check JSON and see exactly where it breaks.
On the related tools: Markdown to HTML – Convert Markdown into clean, safe HTML you can paste anywhere.
In the collection Code Formatters and Minifiers.