Skip to content

XPath Tester

Run XPath expressions against your own XML and see every node that matches.

XPath syntax

/root/child
An exact path from the document root
//name
Every matching element at any depth
//*
Every element
@attr
An attribute — //book/@id
[@id="2"]
A predicate filtering on an attribute
[price<10]
A predicate comparing a child element
[1] and [last()]
Positional selection, counting from one
text()
The text node inside an element
contains(., "un")
Substring matching on the current node
count(//book)
A function returning a number, not a node set

If a document declares a default xmlns, an unprefixed name matches nothing. Use //*[local-name()="title"] instead.

Quick Tool Overview

The XPath Tester evaluates an expression against your own XML using the browser's own XPath 1.0 engine, listing every matching node with its value — or the number, string or boolean the expression returned.

What it does
Runs XPath expressions against an XML document
You give it
Well-formed XML and an XPath expression
You get back
Every match with its value, and a match count
Best for
Building scrapers, XSLT, and API extraction rules
Developer Tools Free, unlimited use No sign-up Runs in your browser

About the XPath Tester

XPath is how you select nodes out of an XML document, and it is very easy to write an expression that looks right and matches nothing. This tester runs one against your own document and lists every match with its value, so you can confirm it before it goes into code.

It uses the browser's own XPath engine, which means the full 1.0 language: child and descendant axes, attribute selection with @, predicates including positional ones, the text() and node() tests, and functions such as contains(), starts-with(), normalize-space(), count() and last(). Expressions that return a number, a string or a boolean rather than a node set are shown as their value.

Key features of the XPath Tester

The real XPath 1.0 engine

Axes, predicates, positional selection and the standard functions all behave exactly as they will in your own code.

Live match count

The count updates as you type, so you can tell immediately whether a predicate narrowed the selection or emptied it.

Non-node results shown

An expression returning count(), a string or a boolean shows its value rather than an empty match list.

Attributes and text nodes

Selecting @id or text() works and displays properly, which is where many testers quietly show nothing.

Syntax reference on the page

The forms you actually type are listed with examples beside your data, including the namespace workaround.

How to use the XPath Tester

  1. 1

    Paste your XML

    The document you want to query, which must be well-formed.

  2. 2

    Write an expression

    Start broad, such as //book, then narrow with predicates.

  3. 3

    Read the matches

    Each match shows its node name and text value, with a count above.

  4. 4

    Refine the expression

    Add a predicate such as [@id="2"] or [price<10] to select exactly what you need.

Frequently asked questions

Prefix it with @, so //book/@id selects the id attribute of every book. Inside a predicate the same syntax filters: //book[@id="2"].

Reviews of the XPath Tester

What people who use the XPath Tester think of it. Reviews come from visitors and are posted as written.

No ratings yet

Yours would be the first.

  • 5 0 reviews rated 5 stars
  • 4 0 reviews rated 4 stars
  • 3 0 reviews rated 3 stars
  • 2 0 reviews rated 2 stars
  • 1 0 reviews rated 1 star

Write a review

Used this tool? Your rating helps the next person decide.

Your rating

Plain text only — links, email addresses and HTML are not accepted. Your name and review are shown publicly; nothing else is collected. See the privacy policy.

0 reviews

Newest first

No reviews yet

Be the first to rate the XPath Tester. It takes half a minute and no account.

Write the first review

More developer tools