XML Formatter
XMLFormat and beautify XML with customizable indentation
All processing happens locally in your browser — your data never leaves your machine.
Loading tool...
Examples
Simple Element
Input
<greeting>Hello, World!</greeting>Output
<greeting>Hello, World!</greeting>Nested with Attributes
Input
<?xml version="1.0" encoding="UTF-8"?><catalog><book id="1" genre="fiction"><title>The Great Gatsby</title><author>F. Sc...Output
<?xml version="1.0" encoding="UTF-8"?>
<catalog>
<book id="1" genre="fiction">
<title>The Great Gatsby</title>
...With CDATA Section
Input
<script><![CDATA[function hello() { return "world"; }]]></script><data><item>Test</item></data>Output
<script>
<![CDATA[function hello() { return "world"; }]]>
</script>
<data>
<item>Test</item>
</data>Frequently Asked Questions
- How does the XML Formatter work?
- Paste your XML into the input panel and it will be automatically formatted with proper indentation. You can choose between 2 or 4 spaces for indentation, or minify the XML to remove all unnecessary whitespace. All processing happens locally in your browser.
- Is my data safe?
- Yes. All formatting is done locally in your browser using JavaScript. Your data never leaves your machine.
- Does it handle CDATA sections and comments?
- Yes. The formatter correctly preserves CDATA sections, XML comments, and processing instructions while applying proper indentation to the rest of the document.