Beautify XML code with proper indentation
XML (Extensible Markup Language) can become difficult to read and maintain when minified or poorly formatted. Formatting XML adds proper indentation, line breaks, and consistent spacing to make the code readable and maintainable. This is essential for debugging, collaboration, and maintaining clean data exchange formats.
This tool takes any XML code and formats it with consistent indentation. It preserves the structure, indents nested elements, and makes the code easy to read and edit.
All processing is done locally in your browser – your code never leaves your device.
Step 1: Paste your XML into the input area. This can be minified or already formatted.
Step 2: Select your preferred indentation size (2 spaces, 4 spaces, or 8 spaces).
Step 3: Click "Format XML". The tool beautifies the XML.
Step 4: Copy the formatted XML using the "Copy XML" button.
The formatter handles self-closing tags, processing instructions, and CDATA sections.
Input (minified):
<root><person><name>John</name><age>30</age></person></root>
Output (formatted with 2 spaces):
<root>
<person>
<name>John</name>
<age>30</age>
</person>
</root>