Developer Tools
XML Formatter and Well-Formedness Checker
Check that XML is well-formed, with the line and column of any error, then indent it with spaces or tabs, minify it, tidy empty elements or remove comments.
How to use XML Formatter and Well-Formedness Checker
Paste XML such as a sitemap, RSS feed or SOAP message. It is checked first: if it is well-formed you get indented output straight away, otherwise an error with its line and column. Options cover minifying, empty elements and comments.
- Paste the XMLPaste a document with a single root element; if there is an XML declaration it must come first.
- Choose the layoutPick Format and validate or Minify to one line, the indent, and whether empty elements are kept, self-closing or expanded.
- Fix and copyIf an error appears, go to the line and column shown, correct it, then copy the formatted XML.
Errors the checker catches
The parser checks that tags are properly nested and closed, attribute values are quoted, no attribute appears twice, & and < in text are written as & and <, there is exactly one root element with no stray text outside it, and the XML declaration sits at the very start. Every error gives a position: a bare & in Fish & chips, for example, is reported at line 1, column 9 with a reminder to write &. Entities such as that XML does not predefine trigger a warning. The tool checks well-formedness only, not validity against an XSD or DTD.
How the output is formatted
Each element goes on its own line, indented by depth, while elements that contain only text stay on one line, so a sitemap loc element keeps its URL between the tags. Comments, CDATA sections, processing instructions and the DOCTYPE are kept, and attributes keep their order and quotes. Whitespace at the ends of text is trimmed and whitespace-only text nodes are dropped, so check content where spacing matters. Minify removes the line breaks and indentation between tags, and Remove comments strips comment blocks from either output.
Accuracy and data handling
Validate the result with your project's own tests and runtime rules before using it in production. The calculation runs in your current browser; the tool code does not send the input to a processing API.
FAQ
Does it validate against an XSD or DTD?
No. It checks well-formedness: tag pairs, quoting, entities and a single root. Validating against a schema needs a validating parser together with the XSD or DTD.
What does Text is not allowed outside the root element mean?
There is ordinary text before or after the single root element, often a stray character from copying or two XML documents pasted together. Remove it or wrap everything in one root.
Will formatting change my data?
Tags, attributes and text content are kept, but leading and trailing whitespace inside text is trimmed. If spacing is significant, compare the output before you use it.
More Developer Tools
Related toolsConvert between binary, octal, decimal, hex and bases 2–36, even for huge numbers
Turn text into ASCII codes, or decode decimal, hex and binary codes to text
Convert text to Unicode escapes for JS, Python, HTML or CSS, and decode them
Bulk-check email address syntax with reasons, typo hints and a clean list
Break a URL into scheme, host, port, path, parameters and fragment
Parse URL parameters into JSON, or build a query string from JSON