Convertools Dev
All tools

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

  1. Paste XML or drop a file such as .xml, .svg, or .rss.
  2. Choose 2 spaces, 4 spaces, tabs, or one line.
  3. 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 input
<?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 result
<?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>