XML Formatter
Paste XML to indent it and check that it is well-formed.
XML input
Paste text or drop a file here (up to 50 MB).
XML result
Free to use. Your input stays in this browser.
How to use it
- Paste XML or drop a file such as .xml, .svg, or .rss.
- Choose 2 spaces, 4 spaces, tabs, or one line.
- Copy or download the result. If the XML is not well-formed, the error shows where to look.
Elements that contain text, such as <p>Hello <b>world</b></p>, keep their content exactly, so meaningful spaces do not change. Elements marked xml:space="preserve" are also left as they are.
The check covers well-formedness: matching tags, quoted attributes, one root element, and valid entities. It does not validate against a DTD or an XML Schema.
Example
<?xml version="1.0" encoding="UTF-8"?>
<!-- Sample catalog -->
<catalog><book id="b1" lang="en"><title>XML Basics</title><price currency="USD">29.99</price><tags><tag>xml</tag><tag>data</tag></tags></book><book id="b2"><title><![CDATA[Fish & Chips <Guide>]]></title><price currency="EUR">12.50</price><note>Ships in <b>2 days</b>.</note></book></catalog><?xml version="1.0" encoding="UTF-8"?>
<!-- Sample catalog -->
<catalog>
<book id="b1" lang="en">
<title>XML Basics</title>
<price currency="USD">29.99</price>
<tags>
<tag>xml</tag>
<tag>data</tag>
</tags>
</book>
<book id="b2">
<title><![CDATA[Fish & Chips <Guide>]]></title>
<price currency="EUR">12.50</price>
<note>Ships in <b>2 days</b>.</note>
</book>
</catalog>