XML Viewer
Open an XML file or paste XML to explore it as a collapsible tree. Click any element to see its attributes, text and exact XPath, search across tags, attributes and text, or run your own XPath query. Large files up to 100 MB load in your browser without uploading.
Last updated:
Tip: you can also drop a file anywhere on this box. Files up to 100 MB are supported.
How to use the XML Viewer
- Open or paste XML: choose a file, drop it on the box or paste text, then press View XML. A sample catalog is shown on load.
- Browse the tree: click the arrows (or use the arrow keys) to open elements. Use Expand 2 levels or Expand all for an overview.
- Select a node to see its type, namespace, attributes, text and XPath in the side panel.
- Copy the XPath or the node's XML for use in code, tests, XSLT or scraping rules.
- Search or query: type text to find matching tags, attributes or text, or enter an XPath such as //book[price>15]/title and press Find.
XPath quick reference
XPath 1.0 is the query language built into browsers, XSLT and most XML libraries. Paste any of these into the XPath box to try them on the sample.
| Expression | Selects |
|---|---|
/library/section | Every section child of the root library |
//book | All book elements anywhere in the document |
//book[2] | Each book that is the second book child of its parent |
(//book)[last()] | The last book in the whole document |
//book[@format='paperback'] | Books whose format attribute equals paperback |
//book[price > 15]/dc:title | Titles of books priced over 15 (prefixes declared in the file work) |
//book/@id | The id attributes (the viewer jumps to their elements) |
//*[contains(text(), 'Soup')] | Elements whose text contains "Soup" (case-sensitive) |
count(//book) | A number: how many books there are |
//*[local-name()='entry'] | entry elements in any namespace, for example in Atom feeds |
Node types you will see in the tree
- Elements such as
<book id="b101">, shown with up to six attributes and the number of child elements. Elements that only hold a short text value are shown on one line. - Text between tags. Whitespace used only for indentation is hidden.
- CDATA sections (
<![CDATA[ … ]]>) hold text that may contain<and&without escaping. - Comments (
<!-- … -->) and processing instructions (<?target data?>), such as stylesheet links.
To make XML readable as text, use the XML Formatter; to check it against a schema, the XML Validator; and to work with the data in JavaScript, XML to JSON.
Frequently asked questions
How do I open an XML file?
Click Open XML file or drop the file on the tool. It is read by your browser and shown as a tree, with nothing uploaded. Any XML-based format works, including .xml, .xsd, .xslt, .svg, .rss, .kml, .gpx, .plist, .config and .csproj files.
How is the XPath of a node built?
The absolute XPath lists every step from the root, adding a position like [2] only when the parent has more than one child element with the same name, for example /library/section[2]/book/author. If an ancestor has an id attribute, a shorter path anchored on it is also shown, such as //book[@id='b101']/author.
Why does my XPath query find nothing when the XML has xmlns?
When elements live in a default namespace (xmlns="…" without a prefix), XPath 1.0 cannot match them with plain names. Use *[local-name()='book'] for those steps; the XPaths this viewer copies already do that. Prefixed names such as dc:title work directly because the prefixes declared in the document are recognized.
Can it open very large XML files?
Files up to 100 MB can be opened. The tree only builds the rows you actually expand, 300 children at a time, so even documents with hundreds of thousands of elements stay responsive. Large files are not copied into the text box, which keeps typing and scrolling fast.
What does 'not well-formed' mean?
XML must follow strict rules: one root element, every tag closed, tags properly nested, attribute values in quotes, and special characters such as & and < escaped as & and <. The viewer shows the first error with its line and column and points to the spot.
Does the viewer change or upload my XML?
No. The file is parsed by your browser's built-in XML parser and is never sent anywhere. The tree is read-only; to reformat or minify XML use the XML Formatter.
Are all the tools on FreeToolCabin tested for quality and accuracy?
Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.