Skip to content
ErgaLab
XPath

XPath Tester

Paste sample HTML or XML and an XPath expression to see every matching node listed instantly.

XPath expression

DOMParser is not defined

Sample HTML/XML

Matches

No matches

No matches yet.

How it works

This tester uses your browser's native document.evaluate engine, so results reflect exactly how XPath 1.0 behaves in a real browser environment. Matched elements are shown as their outer HTML; matched attributes show just the attribute value.

Not sure how to write the expression yet? Start with the XPath Builder and paste the result here to verify it against your own markup.

Examples

By class attribute

List items with a specific class.

//li[@class="item"]

All links

Every anchor element in the document.

//a

Attribute value only

Just the href values.

//a/@href

Frequently asked questions