Beautify, validate, and minify XML in your browser. Pretty-print with configurable indentation, or compress to the smallest valid output — malformed XML is flagged with the exact line and column.
How to use XML Formatter
Paste your XML into the input box.
Choose Beautify (with an indent width) or Minify.
Fix any reported errors, then copy the formatted output.
Frequently asked questions
Is my XML uploaded to a server?
No. Parsing and formatting run entirely in your browser using the built-in XML parser, so your data never leaves your device.
Why is my XML reported as invalid?
Common causes are unclosed or mismatched tags, multiple root elements, unescaped & < > characters, or missing quotes around attribute values. The error points to the exact line and column.
Are comments, CDATA, and the XML declaration preserved?
Yes. Comments, CDATA sections, processing instructions, the DOCTYPE, and the <?xml?> declaration are all kept in the formatted output.