PrettifyPrettify

XML Viewer Online

Paste XML and read it as a tree you can fold, search, and follow, not as a wall of angle brackets. Prettify shows elements, attributes, and text together, and lists repeated elements as a table. Parsing runs in your browser, so nothing is uploaded.

Result
A formatted preview shows here as you paste.
Runs in your browser. Nothing is uploaded.

What the XML viewer does

You give it an XML document, and it gives you a structure you can walk through. The Tree view is the default for XML. Each element is a node that you expand or collapse, with its attributes and text inside it.

A viewer has a different job from a formatter. A formatter fixes the indentation so the text reads well. A viewer helps you find your way: which element holds a value, how deep a node sits, and how many times a tag repeats. The box on this page checks that your XML is well formed and shows an indented copy. The Tree view itself is in the editor.

Key features

The viewer turns the XML tree into keys and values, so the same data can appear in several views. These are the parts you will use most often when you read a document.

  • The Tree view shows elements, attributes, and text as a collapsible tree.
  • An attribute appears under a name with an @ prefix, such as @id, so it stays apart from child elements.
  • Child tags that repeat are grouped into an array, and the Table view lists repeated elements as rows and columns.
  • Search matches keys and values in the Tree view, and cell values and column names in the Table view.
  • The Raw view shows the pretty-printed XML with line numbers and inline problems.
  • A parse error names the line and column, and the Problems panel adds notes for a missing XML declaration and a duplicate attribute.
  • You can open a file, drop a file, or load an address with Fetch URL in the Command Palette.

How to view XML

Start in the box on this page, then continue in the editor. The box reads documents up to 512 KB. A larger document goes straight to the editor, which handles large files.

  1. Paste your XML into the box labeled "Paste your XML", or select "Try an example".
  2. Read the line above the result. It describes the shape of the document, or it names the line and column of a parse error.
  3. Check the indented copy of your XML in the result panel. Select Copy or Download to keep it.
  4. Select "Open in full editor". If the XML has an error, the button reads "Fix it in the editor".
  5. In the editor, expand and collapse elements in the Tree view to follow their children.
  6. Press Cmd+F (Mac) or Ctrl+F (Windows, Linux), then type a name or a value to find it.
  7. Select the Table tab to see repeated elements as rows and columns.

Worked example: a small library

The document below has two book elements. The first has two tag elements. The second has one.

In the Tree view, library holds a book array with two entries. The first book shows @id as b1 and @lang as en, then a title of Dune and a tag array with two values. The second book shows its single tag as a plain value, not an array. Switch to the Table view to see the two book elements as rows.

With Pro, the XPath panel selects nodes by expression. The expression //book[@id="b1"]/title returns the title element of the first book. Free users get one free try of XPath each day.

<library>
  <book id="b1" lang="en">
    <title>Dune</title>
    <tag>sci-fi</tag>
    <tag>classic</tag>
  </book>
  <book id="b2" lang="fr">
    <title>Les Misérables</title>
    <tag>novel</tag>
  </book>
</library>

Common uses

XML turns up in older APIs, build files, exports, and image formats. A tree is the quickest way to learn what such a file contains before you write code against it.

  • Read a SOAP or other XML API response without counting closing tags.
  • Check a sitemap.xml or a Maven pom.xml for the element you need.
  • Look inside an SVG file, which opens as XML.
  • Read an RSS or Atom feed in the Tree view. The Feed view for feeds is Pro.
  • Confirm the shape of a document before you convert it to JSON.

What is free, what is Pro, and where your XML goes

The Tree, Raw, and Table views are free. Three XML tools are Pro: the Diagram view, the Feed view for RSS and Atom, and the XPath panel. Each has one free try per day. Pro costs US$19.99 once, with lifetime access and no subscription.

Parsing runs on your device, and Prettify does not upload your XML unless you share it. When you load an address, your browser fetches it directly. If the site blocks the request, Prettify asks before it uses a public proxy.

Frequently asked questions

Is the XML viewer free?

Yes for the core views. The Tree, Raw, and Table views, search, and validation are free and need no account. The Diagram view, Feed view, and XPath panel are Pro, each with one free try per day.

Can I open an XML file or load XML from a URL?

Yes to both. Select Open file on the Dashboard or drop the file on the editor. To load an address, open the Command Palette with Cmd+K or Ctrl+K and select Fetch URL. The response limit is 100 MB.

Why does one tag show as a value and two show as an array?

Only child tags that repeat under the same parent are grouped into an array. A tag that appears once shows as a plain value. In the example, the first book has an array of two tags and the second has one tag.

What happens if my XML is not well formed?

Prettify shows the parse error with its line and column. In the editor, the Problems panel lists the error, so you can jump to it, fix it, and view the document again.

How large an XML file can I view?

The box on this page reads up to 512 KB. Larger documents open in the full editor, which handles large files. The tree can then be searched and folded as usual.

Related tools