About XPath Tester
You paste XML or HTML into the page and type an XPath 1.0 expression. The tool uses your browser's XPath engine and evaluates the expression locally, so nothing is uploaded. It lists each matching element, attribute or text node with its markup. If your expression returns a number, string or boolean, the tool shows that result as well, for example count() or sum(). The tester reports XML parse errors and can ignore namespaces so //book will match elements in documents with a default xmlns. You will find a short set of example expressions to try. This makes the tool useful for quick checks, debugging Selenium locators, or learning XPath without installing anything.
How to use it
- 1Paste or type your XML or HTML into the input pane.
- 2Enter an XPath 1.0 expression in the expression box.
- 3Optionally enable ignore namespaces to match unprefixed names in XML with xmlns.
- 4Click Evaluate to see matched nodes, or the numeric/text/boolean result of functions.
Worked example
Input XML: <books xmlns="http://example.com/ns"> <book id="b1"><title>Alpha</title></book> <book id="b2"><title>Beta</title></book> <book id="b3"><title>Gamma</title></book> </books> Expression: //book Exact result shown by the tool: Matched nodes (3): <book id="b1"><title>Alpha</title></book> <book id="b2"><title>Beta</title></book> <book id="b3"><title>Gamma</title></book> Expression: count(/books/book) Exact result: 3
How it works
Runs an XPath 1.0 expression against pasted XML or HTML with the browser's own XPath engine and lists every matching element, attribute or text with its markup, or the number, text or true/false result of functions such as count() and sum()Shows XML errors, can ignore namespaces so //book works on files with xmlns, and has example expressions to tryWorks in the browser with nothing to installSource: W3C XPath 1.0 RecommendationMDN - Document.evaluate (browser XPath API). Last checked 7 November 2026.
What it is good for
- Runs entirely in your browser; nothing is uploaded.
- Shows matched nodes with full markup and function results like count() or sum().
- Can ignore namespaces so unprefixed paths match XML with a default xmlns.
- Uses the browser's XPath 1.0 engine only; XPath 2.0/3.1 features like matches() are not supported.
Questions people ask
Which XPath version does this tester use?
This tester uses XPath 1.0 provided by your browser's document.evaluate API. If you need XPath 2.0 or 3.1 features, use a dedicated server engine or a JavaScript XPath 3.x library.
Does the tool upload my XML to a server?
No. The evaluation runs in your browser so your input stays local. Do not paste sensitive data if you plan to copy results elsewhere.
Why does my XPath return nothing when the element exists?
Common issues include a default namespace, wrong context node, or extra whitespace. Try enabling ignore namespaces or use local-name() tests when matching namespaced elements.
Can I get the absolute XPath of a matched node?
The tool lists each matched node and its markup. Some testers offer a click-to-copy absolute path. Use the node list here to build an absolute path if needed.
Will functions like count() and sum() work?
Yes. Functions that exist in XPath 1.0, such as count() and sum(), return numeric, string or boolean results. Functions from XPath 2.0/3.1 are not available.
Can I test HTML as well as XML?
Yes. You may paste HTML or XML. For HTML, results depend on how your browser parsed the input. For strict XML behavior, use well-formed XML input.
Help keep every tool free
FreeToolr stays free because people help it grow. Share a tool you like, tell us what to build next, or support us on Ko-fi.