How to Use
- Enter XML
Paste or type XML into the input area.
- Format
Click "Convert" to format the XML. You can adjust the indent size in the toolbar.
- Copy result
Use the "Copy" button to copy the formatted XML to your clipboard.
XML Formatter Examples
XML Prettify
Input
<root><item><name>John</name><age>30</age></item></root>Output
<root>
<item>
<name>John</name>
<age>30</age>
</item>
</root>Each element is placed on its own line with proper indentation.
With XML declaration
Input
<?xml version="1.0"?><data><entry key="a">value</entry></data>Output
<?xml version="1.0"?>
<data>
<entry key="a">value</entry>
</data>Features
- Accurate XML parsing with DOMParser
- Indented formatting per element
- Configurable indent size (2 or 4 spaces)
- Self-closing tag recognition
- CDATA and comment preservation
- XML syntax error detection and reporting
- Local processing for privacy
FAQ
Does it validate XML?
Yes. It uses the browser DOMParser, so syntax errors are detected and reported.
Does it support XML namespaces?
Yes. XML with namespace prefixes is formatted correctly.
Is my data sent to a server?
No. All processing happens locally in your browser and nothing is uploaded.