Code Formatters
XML Formatter
Format XML into readable, indented markup. Well-formedness is checked with the browser's native XML parser first, so a genuinely malformed document (like a mismatched closing tag) is reported as an error instead of being silently repaired.
Advertisement
Advertisement
Related tools
Features
- Real well-formedness validation, not just indentation
- Preserves comments, CDATA sections, attributes, and declarations
- 2, 4-space, or tab indentation
How to use
- Paste your XML into the input.
- Pick an indentation size and click Format.
- If the XML isn't well-formed, the error explains what's wrong.
Example
Input
<root><a>1</a><b>2</b></root>
Output
<root> <a>1</a> <b>2</b> </root>
FAQ
- Does this catch mismatched tags?
- Yes. Your XML is checked for well-formedness with the browser's native XML parser before formatting — a mismatched closing tag or other structural problem is reported as an error rather than silently fixed.
- Are comments and CDATA sections preserved?
- Yes, both are kept as-is in the formatted output.
Advertisement