FormatterHQ

XML Viewer

Open any XML file as a collapsible tree to see its structure at a glance, with the formatted markup one tab away. Large documents stay responsive because branches render as you open them.

Input XML
Output XML
Ready.

How to use the XML Viewer

  1. Paste XML, drop a file on the editor, use Upload file, or fetch a feed or API response with Load URL.
  2. Click View Tree. The Tree tab opens with the first two levels expanded.
  3. Click any node to expand or collapse it; the counts next to each node show how many keys or items it holds.
  4. Switch to the Code tab for the indented markup (choose the Indent), or click Minify for a compact copy.

An XML viewer for finding your way around a document

This XML viewer is built for the moment when you open a file and have no idea what is in it: a vendor export, a Maven POM, a feed or a configuration file that runs to thousands of lines. Instead of scrolling through markup, you get a tree you can fold and unfold, with attributes and child elements listed under each node and counts that show where the bulk of the data is.

How XML appears in the tree

Take this small catalog:

<catalog>
  <book id="bk101" lang="en">
    <title>XML Developer's Guide</title>
    <price>44.95</price>
  </book>
  <book id="bk102" lang="en">
    <title>Midnight Rain</title>
    <price>5.95</price>
  </book>
</catalog>

The tree is built from this structure:

{
  "catalog": {
    "book": [
      { "@id": "bk101", "@lang": "en", "title": "XML Developer's Guide", "price": "44.95" },
      { "@id": "bk102", "@lang": "en", "title": "Midnight Rain", "price": "5.95" }
    ]
  }
}

So when you read the tree, keep three conventions in mind:

  • Attributes are listed first and start with @, so @id is the id attribute, not a child element.
  • Repeated siblings are grouped: the two <book> elements appear as one book node marked as a list of 2 items, numbered from 0.
  • Text appears directly as the value when an element has only text. When it also has attributes, the text is shown under #text.

The XML declaration and processing instructions are not part of the tree, and neither are comments. They are still in the Code tab.

Working with large files

The first two levels open automatically. Deeper branches are only rendered when you expand them, which keeps the page usable with multi-megabyte documents. A node with more than 2,000 children shows the first 2,000 and a line saying how many more there are.

A practical way to explore an unfamiliar file is to collapse everything below the root, look at the counts to find the repeating element that holds the records, then open one record to learn its shape. Once you know the path, the XPath tester lets you pull out exactly the values you need.

Code tab: formatted or minified

Every View Tree run also produces indented markup in the Code tab, using the Indent you choose. Format switches the output to indented XML only, and Minify gives you a single-line version plus the bytes saved. Use Copy or Download on whichever view you need.

When the tree does not appear

The viewer only draws a tree for well-formed XML. If the status bar shows an error such as Expected closing tag 'book' … instead of closing tag 'catalog', the file is truncated or has a broken tag at the reported line and column. Fix it in the editor and the tree reappears. HTML pages usually fail for the same reason, because tags like <br> are never closed.

Viewer or editor?

The tree is read-only; it is for looking. If you want to change values and keep checking the result, the XML editor is set up for that workflow. And if you plan to process the data in JavaScript, XML to JSON converts the same structure into a JSON document you can copy.

Privacy

Parsing and rendering happen in your browser; files you open are not uploaded. The exceptions are Load URL, which retrieves the address through our server, and Save & Share, which stores the content to create a link.

Frequently asked questions

Why do some elements show as a list and others as a single object?
An element that appears several times under the same parent is grouped into a list. If it appears only once, it is shown as a single node. The same element name can therefore look different in two parts of a file.
Where are my comments in the tree view?
Comments, the XML declaration and processing instructions are not part of the data tree. They are kept in the Code tab, which shows the full formatted document.
Can I open an XML file from a URL?
Yes. Click Load URL and enter the address of the file, for example an RSS feed or a sitemap. The file is fetched through our server so that cross-origin restrictions do not block it.
Can I edit the XML in the tree?
No, the tree is read-only. Make changes in the input editor; with Auto update on, the tree refreshes as you type.

Last updated October 3, 2026

Related tools

BBCode Viewer Preview BBCode forum posts before publishing: bold, colours, links, quotes, lists, code and spoilers rendered live. CSV Viewer View CSV files as a clean, sortable-looking table in your browser. Auto-detects commas, semicolons, pipes and tabs. Excel Viewer Open and view Excel (.xlsx, .xls), OpenDocument (.ods) and CSV spreadsheets online without Excel. Sheet tabs, merged cells and JSON tree. EXIF Viewer Read EXIF, GPS, XMP, IPTC and ICC metadata from photos — camera, lens, exposure, date and location — without uploading the file. HTML Viewer Paste HTML or open a file and see it rendered instantly in a safe, sandboxed live preview. Free online HTML viewer. JSON Viewer & Beautifier View JSON as a collapsible tree and beautify it at the same time. Explore nested objects and arrays without losing your place. XML XSL Transform Apply an XSLT stylesheet to XML online and preview the result. Produce HTML, XML or text output from any XML document. XPath Tester Test XPath expressions online against your XML. See matched nodes, attributes, strings, numbers or booleans instantly. MXML Viewer View and format Adobe Flex / Apache Royale MXML files online with a component tree and neatly indented markup. OPML Viewer View OPML subscription lists and outlines as a clickable, nested list. Inspect feed URLs exported from any RSS reader. RSS Feed Viewer View RSS and Atom feeds as readable articles. Paste feed XML to preview titles, links, dates and summaries. SOAP Formatter Format SOAP request and response envelopes online. Beautify headers and body, validate the XML and pinpoint errors.