XML Formatter & Validator
Validate and beautify XML, with errors shown by line number.
Formatted XML appears here.
Runs entirely in your browser. Nothing you paste or upload leaves your device.
How to use the XML formatter & validator
- Paste XML into the input box, or press “Sample”.
- Press “Format” to beautify it, “Minify” to shrink it, or “Validate” to check it.
- Copy or download the output.
XML formatter & validator example
Input: <order><id>17</id><item qty="2">Pen</item></order> on one line. Formatted output puts each element on its own line and indents children by two spaces, which makes nesting errors easy to spot.
Common XML errors
- A tag opened but not closed, or closed in the wrong order.
- An unescaped & in text — write &.
- More than one root element.
- Attribute values without quotes.
XML formatter & validator: common questions
- What does “Invalid XML” mean?
- The document is not well-formed. The error names the line, so you can find the problem — an unclosed tag or a stray & is the usual cause.
- What does Minify do?
- It removes the extra spaces and line breaks, leaving the same XML in one compact line.
- Is my XML uploaded?
- No. Everything runs in your browser.
- Is XML valid if it is well-formed?
- Well-formed means the syntax is correct. "Valid" also means it matches a schema (XSD or DTD), which this tool does not check.