XPath Tester (Live XML / HTML)

Type an XPath expression and an XML / HTML document; the tool evaluates and shows matched nodes. Browser-native XPath 1.0 (no XPath 2/3 features). Useful for verifying scrapers, parsers, document transformations.

How to use the XPath Tester (Live XML / HTML)

Paste an XML or HTML document and type an XPath expression. The tool evaluates it and lists the matched nodes — elements, attributes, or a computed value. Use the example buttons to try predicates, attributes, and functions like count().

Testing XPath expressions

XPath navigates XML and HTML documents and turns up everywhere data is pulled from markup — scrapers built on lxml or Scrapy, XSLT transforms, SOAP and config parsing, and Selenium element locators. An expression that uses predicates, axes, and functions is easy to get subtly wrong, returning nothing or the wrong nodes.

This evaluates an XPath 1.0 expression against a pasted XML or HTML document using the native browser engine and shows what it matched — elements, attributes, or a computed value such as count(). Because it is browser-native, it is XPath 1.0 only; 2.0 and 3.0 functions are unavailable. For CSS selectors rather than XPath, the CSS selector tester is the counterpart, and to tidy a document before testing against it, the XML formatter.

Common use cases

  • Debug a scraper — see why an lxml or Scrapy XPath returns no nodes.
  • Build Selenium locators — verify an XPath before using it as a locator.
  • Test predicates — check [@category='fiction'] and positional filters.
  • Use functionscount(), text(), and contains() against a document.
  • Extract attributes — confirm //tag/@attr selects the right values.

Frequently asked questions

Which XPath version is supported?

XPath 1.0, via the native browser engine. XPath 2.0 and 3.0 functions are not available.

Can I query HTML as well as XML?

Yes — both are accepted and evaluated as documents.

How is this different from the CSS selector tester?

XPath has axes, predicates, and functions that CSS lacks; for CSS selectors use the CSS selector tester.

Can it return a number or string?

Yes — expressions like count(//book) return a number and text() returns string values.
Embed this tool on your site

Free to embed, no attribution required (but appreciated). Paste this where you want the tool to appear: