XML Formatter
Format or minify XML
Input
Result
Read-only
What is XML Formatter?
XML Formatter is a tool for making XML easier to read or compressing it by removing extra whitespace and line breaks. It is useful for API responses, configuration files, and XML data review.
The result updates in real time, and you can switch the indentation style.
How to Use
- Enter your XML string.
- Choose an indentation style.
- Change the space count if needed.
- Review the formatted XML in the result area.
If the XML is invalid, the tool shows an error message.
Main Settings
Indent
- Spaces
- Tab
- None
Use spaces or tabs for readability, or choose None when you want compact XML in one line.
Indent Spaces
When Spaces is selected, you can choose 2, 4, 6, or 8 spaces.
Input and Output Example
<?xml version="1.0" encoding="UTF-8"?><bookstore><book category="cooking"><title lang="en">Everyday Italian</title><author>Giada De Laurentiis</author></book></bookstore>
After formatting, the result looks like:
<?xml version="1.0" encoding="UTF-8"?>
<bookstore>
<book category="cooking">
<title lang="en">Everyday Italian</title>
<author>Giada De Laurentiis</author>
</book>
</bookstore>
Use Cases
- Making API XML responses easier to inspect
- Reviewing the structure of XML configuration data
- Preparing formatted XML for sharing or review
- Compressing XML into a single line when needed
Things to Keep in Mind
- XML with mismatched tags or invalid syntax cannot be formatted
- Very large XML input can slow down the browser
- In compact mode, line breaks and indentation are removed