XML Formatter
How to use
- Paste your XML into the input box.
- Choose Format or Minify, and the indentation for formatting.
- Copy the result. If the XML is broken, the error message says what the parser found.
How it works
The input is split into tags, text, comments, CDATA sections, declarations and processing instructions. Each tag changes the nesting level, and each level adds one indent.
An element holding only text stays on one line, such as <name>Ada</name>. Mixed content puts text and child tags on separate lines.
Minify removes whitespace between tags and trims the edges of text. Whitespace inside text is kept. Your browser's XML parser then checks the result for well-formedness.
FAQ
Does formatting change the meaning of my XML?
Whitespace between tags is the only thing added or removed. Text inside elements keeps its inner spacing. For documents where whitespace is meaningful, check the output before using it.
What counts as an error?
Unclosed or mismatched tags, a missing closing bracket, several root elements, bad attributes and similar problems that break well-formed XML.
Is my XML uploaded?
No. Formatting and parsing happen in your browser.