Skip to content

XPath Tester

Run an XPath 1.0 expression against XML or HTML and list every matching node. Paste a document, enter an expression such as //item[@type='book']/title, and see each match with its text and markup, or the value of expressions such as count(//item). HTML is parsed the way browsers parse it, so tag soup and missing end tags work too.

Reset

Frequently asked questions

Which XPath version is supported?

XPath 1.0, the version browsers, lxml, Selenium and most XML libraries implement. It covers paths, predicates, axes such as following-sibling and ancestor, and functions such as contains, starts-with, count, sum, string and normalize-space.

What is the difference between XML and HTML mode?

XML mode requires well-formed XML and reports the first parse error. HTML mode parses the input with the HTML5 parsing algorithm, so unclosed tags, unquoted attributes and implied elements such as tbody are handled the way a browser handles them.

How do I query elements in a namespace?

Prefixes declared in the document, such as xmlns:atom, are bound automatically, so //atom:entry works. A default namespace (xmlns="...") is bound to the prefix d, so you write //d:item. The bound prefixes are listed below the results.

Why does my HTML query find a tbody I did not write?

Browsers add a tbody element to every table, and HTML mode builds the same tree. Write //table/tbody/tr or //tr to match rows, just as you would in the browser developer tools.

What do I get for expressions that are not node sets?

Expressions such as count(//a), sum(//price) or string(//title) return a number, string or boolean. The tool shows that value and its type instead of a list of nodes.

How many matches are listed?

The total number of matches is always shown, and the first 500 are listed with their type, name and text. Each match carries its markup, shortened to 2,000 characters for large elements.

About OneClick Pro

OneClick Pro is a free collection of more than 150 web tools for everyday work: converting images and units, formatting and validating code, checking domains and SEO, and working with text, dates and numbers. Every tool runs without registration or subscription, and what you enter is only used to calculate your result and is never stored. Use it as a quick toolbox for one-off tasks, or bookmark the tools you rely on every day.