XML Formatter & Validator
Paste XML to beautify or minify it and check that it is well-formed, with the exact line and column of any error. Comments, CDATA, the XML declaration and DOCTYPE are kept, and text that mixes words with tags is left exactly as written. Everything runs locally in your browser; your XML is never uploaded.
Runs locally in your browserHow to use XML Formatter & Validator
- Paste XML. Paste or type your XML into the input panel, or load the sample.
- Choose options. Pick beautify or minify, the indentation, and whether to remove comments.
- Format. Click Format. Fix any error at the line and column shown, then copy or download the result.
Example
Beautifying a one-line XML message.
Input
<note id="7"><to>Ada</to><from>Charles</from><body>Meet at 10</body></note>
Options: Beautify, 2 spaces
Output
<note id="7"> <to>Ada</to> <from>Charles</from> <body>Meet at 10</body> </note>
Formats, limits and privacy
- Input
- XML
- Output
- XML
- Limits
- Checks that XML is well-formed; it does not validate against a DTD or XML Schema.
- Entities declared in a DOCTYPE are accepted but never expanded, and nothing external is loaded.
- No fixed size limit; very large documents depend on your device's memory.
- Privacy
- Everything happens in your browser. Your input is never uploaded to a server.
Troubleshooting
An error about "&" or an unknown entity
Write a literal ampersand as &. HTML names such as are not defined in XML; use the numeric form   instead.
"Only one root element is allowed"
An XML document must have exactly one outer element. Wrap the elements in a single parent, such as <items>…</items>.
Part of the document was not re-indented
Elements that mix text with tags, or use xml:space="preserve", are copied exactly so whitespace in your text does not change. This is intentional.
Frequently asked questions
Is my XML uploaded to a server?
No. Formatting and checking run entirely in your browser; nothing is sent anywhere.
Does it validate against a DTD or XML Schema?
No. It checks that the XML is well-formed: one root element, every tag closed and matched, quoted attributes, no duplicate attributes and valid entity references. Checking against a DTD or XSD is not supported yet.
Will formatting change my data?
It only changes whitespace between tags. Text inside elements, attribute values and their quotes are kept as written, and elements that mix text with tags, or use xml:space="preserve", are copied unchanged.
Why is "&" an error?
In XML a literal ampersand must be written as &. Only < > & ' ", numeric references like © and entities declared in a DOCTYPE are allowed.