Skip to content
Categories
XML Formatter
Format XML to make it easier to read.
Overview
- Formats XML whose tags are packed into a single line, adding indentation and line breaks to make it easy for humans to read.
- Preserves attributes, comments, and CDATA sections while formatting, so only readability is improved without losing content.
- Useful when you need to visually inspect XML data, such as a SOAP API response or a configuration file.
Usage
- Enter the XML you want to format into the text area.
- Click the "Format" button.
- The result, formatted with 2-space indentation, is displayed below. Use the "Copy" button to copy it to the clipboard.
Example
Input
<root><name>Taro</name><age>20</age></root>
Output
<root> <name>Taro</name> <age>20</age> </root>
Use Cases
- Formatting minified XML, such as a SOAP API response, to understand its structure
- Improving readability of configuration files such as pom.xml or web.xml before editing
- Formatting XML received from another system into a form that is easier to review
FAQ
Is the XML I enter sent anywhere?
No. All formatting happens entirely in your browser and is never sent to an external server.
What happens if I enter invalid XML?
An error message "The XML format is invalid." is displayed. Check for missing or mismatched closing tags.
Are attributes and comments preserved?
Yes. Attributes, comments, and CDATA sections are preserved during formatting.
Notes
- Formatting fails if there is a syntax error, such as a missing or extra closing tag.
- Attributes, comments, and CDATA sections are preserved during formatting.
- Formatting very large XML data may make browser processing slow.
Related Tools
Validate whether XML syntax is correct.
Convert JSON to XML format.
Validate whether JSON is correctly formatted.