Code Tools

Element Extractor

All tools

Type a CSS selector and get the full markup of every matching element from a pasted page.

How it works

Four simple steps

1

Paste page source

Add a full page or a fragment to the HTML panel.

2

Enter a selector

Type any CSS selector, such as img[alt=""] or .card h3.

3

Review matches

Each matching element is listed with its full markup and a count.

4

Copy the results

Copy the list or download it as a text file.

Element Extractor

About Element Extractor

You are auditing a page and need every outbound link, every image tag or every element with a certain class, without opening DevTools and clicking through the tree. Paste the source, type the selector, and the matches are listed.

The extractor parses your HTML with DOMParser and runs querySelectorAll with whatever selector you type, so anything the browser supports works: tag names, classes, IDs, attribute selectors like a[href^="http"], pseudo-classes like li:nth-child(odd), and comma-separated lists. Each match is output as its complete outerHTML, separated by a blank line, and the status line shows how many elements matched. Results update when you change either the selector or the HTML, and an invalid selector shows the browser's error rather than failing silently.

The default selector is a[href], a quick way to list every link on a page. Matches include their children, so selecting div on a nested layout returns overlapping chunks; use a more specific class or a child combinator to avoid that. To see how many of each tag a page uses before choosing a selector, run the tag counter. For structured output instead of raw markup, try HTML to JSON, and when a pattern is easier to express as text, the Regex Matcher works on the source directly.

DOMParser builds an inert document here: scripts in the pasted page do not run, and the HTML is not sent anywhere.

Keyboard shortcut

Ctrl Enter - Run tool
FAQ

Frequently asked questions

See all FAQs

Answers for this tool. For site-wide help, open the FAQ hub.

Not directly; output is always the element's full markup. Paste the matches into HTML to Text for the words, or use the Regex Matcher with a pattern that captures the quoted value after href= to pull attribute values.

It supports whatever your browser's querySelectorAll supports. Current versions of Chrome, Edge, Firefox and Safari all handle :has(), :is() and :where().

DOMParser adds html, head and body wrappers around fragments. Broad selectors such as * or body > * will therefore also match those generated elements.

View more FAQs

Related tools

View all

HTML Formatter

Beautify and indent HTML markup.

Open

CSS Formatter

Format and pretty-print CSS.

Open

JS Formatter

Beautify JavaScript code.

Open

JSON Formatter

Beautify and validate JSON.

Open

Explore 321 free tools

Everything you need as a developer, marketer or creator - in one beautiful place.

Browse all tools