Extract domains

Extract domains scans pasted text for http and https URLs and email addresses, then lists the host part of each one per line. https://www.example.com/pricing yields www.example.com, and [email protected] yields example.net. Strip www. removes a leading www., Unique only lists each domain once, and Include emails can be turned off to read URLs alone. The transform runs in your browser. For the full links, see extract URLs; for the addresses, see extract emails.

Input
Line 1:1 LF
Result Extract Domains
0 lines 0 chars

How domain extraction works

URLs are matched by their http:// or https:// scheme, the same rule the URL extractor uses, so only links that start with a scheme are found. From each match the scheme is dropped and everything from the first slash, colon, question mark, or hash onward is cut, leaving the host. A trailing sentence period is trimmed, so https://example.com. gives example.com.

When Include emails is on, addresses are matched too and the part after the @ is taken as the domain, so [email protected] yields example.org. Every host is lowercased, because domain names are case-insensitive, so Example.com and example.com are treated as one.

Two toggles shape the list. Strip www. removes a single leading www. label, folding www.example.com into example.com. Unique only, on by default, keeps the first appearance of each domain and drops later repeats, so two links to the same site produce one line. Turn it off to get one entry per match in original order.

How to use extract domains

  1. 1Paste text that contains URLs or email addresses into the input panel.
  2. 2Read the extracted domains, one per line, in the output panel.
  3. 3Turn on Strip www. to fold www.example.com into example.com.
  4. 4Turn off Include emails if you only want domains from URLs.
  5. 5Leave Unique only on to list each domain once, or turn it off to keep every match.

Keyboard shortcuts

Drive TextResult without touching the mouse.

Shortcut Action
Ctrl FOpen the find & replace panel inside the input Plus
Ctrl ZUndo the last input change
Ctrl Shift ZRedo
Ctrl Shift EnterToggle fullscreen focus on the editor Plus
EscClose find & replace, or exit fullscreen
Ctrl KOpen the command palette to jump to any tool Plus
Ctrl SSave current workflow draft Plus
Ctrl PRun a saved workflow Plus

What this tool actually does

Host from URLs and emails

The host is taken from http and https URLs and, when Include emails is on, from the part after the @ in email addresses. Bare hostnames with no scheme and no @ are not matched, matching the behaviour of the URL extractor.

Path, port, and query are dropped

Everything from the first /, :, ?, or # is cut, so https://example.com:8080/path?q=1 reduces to example.com. A trailing sentence period is also removed.

Case-folded hosts

Every domain is lowercased before output, because domain names are case-insensitive. Example.COM and example.com collapse to the same entry, which also lets Unique only match them.

Optional www stripping

Strip www. removes one leading www. label so www.example.com becomes example.com. Other subdomains like blog.example.com or mail.example.com are left intact.

First-seen dedupe

With Unique only on, each domain is listed once in the order it first appears, so a page that links the same site several times gives one line. Turn it off to keep one entry per match.

Worked example

Include emails on, Unique only on, Strip www. off. The two links share news.example.com so it appears once, and the address contributes mail.example.org.

Input
See https://news.example.com/a and https://news.example.com/b. Ping me at [email protected].
Output
news.example.com
mail.example.org

Settings reference

Setting or behaviour Effect on output
URL matching Only http:// and https:// links are scanned for a host.
Path / port / query Cut at the first /, :, ?, or #; a trailing period is trimmed.
Include emails (default on) When on, the domain after @ in email addresses is also listed.
Strip www. (default off) When on, a leading www. is removed from each host.
Unique only (default on) When on, each domain appears once in first-seen order; off keeps every match.
Case All hosts are lowercased before output.

FAQ

Does it get domains from email addresses too?
Yes, when Include emails is on, which is the default. The part after the @ is taken as the domain, so [email protected] gives example.org. Turn the toggle off to read domains from URLs only.
Will it find bare domains like example.com with no http?
No. Only http:// and https:// URLs and email addresses are matched, the same rule the URL extractor uses. A bare hostname with no scheme and no @ is skipped, so ordinary words containing dots are not mistaken for domains.
Does it keep the www. or the path?
The path, port, query, and fragment are always dropped, so only the host remains. The www. label is kept by default; turn Strip www. on to remove it. Other subdomains such as blog. or mail. are always kept.
Are duplicate domains removed?
By default yes. Unique only is on, so each domain is listed once in the order it first appears. Turn it off to get one line per match, including repeats.
Does it return the root domain or the full host?
It returns the full host as written, minus an optional www.. It does not compute the registrable root, so a.b.example.co.uk stays as a.b.example.co.uk. Use Strip www. for the common case of folding www..