Format XML Text

Sep 29, 2017

XML Formatter is used to Format XML text, documents or files by indenting & syntax highlighting them. The objects are layed out in a tree like structure which can be easily expanded/collapsed. The desired indentation level can be selected from the settings.



Input: Paste XML text below

Settings

Output: Formatted XML


Minify, uglify or compress XML text by removing unessential whitespace

View Tool

XML is a widely used language that was once the de facto standard for data interchange between applications. Since the advent of JSON, however, it has lost the advantage to the more simple nature of JSON. Nevertheless, XML is still used by applications and SOAP based web services. Read more at wikipedia

Settings Explained
  • 1. Indentation

    This setting governs how the output is indented which is something that varies depending upon your text editor settings. You have choice between the following indentation levels:-

    • 2 Spaces
    • 3 Spaces
    • 4 Spaces
    • 1 Tab
    • None
    The indented output is easier for humans to comprehend. This is the most important use of this tool as people paste the minified or unformatted XML and try to understand what's in it via indentation.

    2 Spaces

    <?xml version="1.0"?>
    <people>
      <person id="007">
        <name>James Bond</name>
        <age>69</age>
      </person>
      <person id="100">
        <name>Sir Donald Bradman</name>
        <age>100</age>
      </person>
    </people>
    3 Spaces

    <?xml version="1.0"?>
    <people>
       <person id="007">
          <name>James Bond</name>
          <age>69</age>
       </person>
       <person id="100">
          <name>Sir Donald Bradman</name>
          <age>100</age>
       </person>
    </people>
    4 Spaces

    <?xml version="1.0"?>
    <people>
        <person id="007">
            <name>James Bond</name>
            <age>69</age>
        </person>
        <person id="100">
            <name>Sir Donald Bradman</name>
            <age>100</age>
        </person>
    </people>
    1 Tab

    <?xml version="1.0"?>
    <people>
    	<person id="007">
    		<name>James Bond</name>
    		<age>69</age>
    	</person>
    	<person id="100">
    		<name>Sir Donald Bradman</name>
    		<age>100</age>
    	</person>
    </people>
    None

    <?xml version="1.0"?>
    <people>
    <person id="007">
    <name>James Bond</name>
    <age>69</age>
    </person>
    <person id="100">
    <name>Sir Donald Bradman</name>
    <age>100</age>
    </person>
    </people>
  • 2. Line Breaks

    If selected, line breaks are added to elements

    Line Breaks: On

    <?xml version="1.0"?>
    <people>
    <person id="007">
    <name>James Bond</name>
    <age>69</age>
    </person>
    <person id="100">
    <name>Sir Donald Bradman</name>
    <age>100</age>
    </person>
    </people>
    Line Breaks: Off

    <?xml version="1.0"?><people><person id="007"><name>James Bond</name><age>69</age></person><person id="100"><name>Sir Donald Bradman</name><age>100</age></person></people>
Comments 0

History
Aug 31, 2017
Tool Launched