Extract Domains From a List of URLs (Online, Excel, Regex)
A domain extractor is the cleanup step before anything else: backlink exports, access logs, a dumped HTML sitemap, a partner spreadsheet of “website” cells that mix https://, bare hosts, and trailing paths. FlashKit’s domain extractor runs in this tab. It does not fetch the URLs, does not talk DNS, and does not upload the paste.
Use cases: backlink lists, log cleanup, email lists
Backlink CSVs from a crawler usually store the full source URL. You want the host, once. Access logs bury the host inside a quoted request or a referrer. CRM exports mix www.example.com and example.com as if they were the same row. This page gets you a unique hostname list. It does not decide whether two hosts are “the same company.”
If the next job is resolving those names to A/AAAA records, that is a different tool and a different guide: extract here, then find the IP with nslookup, dig, or the domain-to-IP converter. Internationalized labels are a one-sentence detour — convert Unicode to xn-- with the Punycode explainer before you extract.
Online: FlashKit domain extractor walkthrough
The page is two boxes. Paste text on the left, press Extract. The right box lists unique hosts, lowercased, in first-seen order, with a copy button. The regex is:
/(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9][a-z0-9-]{0,61}[a-z0-9]/gi
That is a hostname-shaped token: labels, dots, a last label that looks like a TLD. It is not a URL parser. Ran on 10 Nov 2026 against this paste:
https://blog.example.co.uk/a?b=1
http://www.example.com
example.org/path
Visit report.pdf and 192.0.2.33
the unique list was blog.example.co.uk, www.example.com, example.org, report.pdf, 192.0.2.33. Subdomains and www. are kept. report.pdf and a dotted IPv4 string match because they look like hosts. The tool does not apply the Public Suffix List, does not drop file-name lookalikes, and does not skip RFC 5737 documentation IPs. Say that before you paste a legal hold.
Extract domains from pasted text
Hostname regex, lowercase, unique. Local only — no crawl, no DNS.
Open the domain extractorSheets and Excel formulas (tested)
Google Sheets, formula in B2 copied down, pattern tested in a JS match with the same capturing group Sheets REGEXEXTRACT uses (first group):
=REGEXEXTRACT(A2,"(?:https?://)?([^/?#]+)")
| A (input) | Sheets REGEXEXTRACT |
|---|---|
https://blog.example.co.uk/a?b=1 | blog.example.co.uk |
http://www.example.com | www.example.com |
example.org/path | example.org |
https://www.example.com/x | www.example.com |
http://sub.example.org | sub.example.org |
files.example.net/dir | files.example.net |
All six are RFC 2606 / example.* style hosts. The formula does not handle ftp:// (the optional group only strips http:// and https://; ftp://files.example.net/dir captured ftp: in the same matcher). Excel 365: use REGEXEXTRACT if your build has it. Otherwise strip schemes then take the segment before /:
=LET(s,SUBSTITUTE(SUBSTITUTE(A2,"https://",""),"http://",""),TEXTBEFORE(s,"/",1,1,0,s))
TEXTBEFORE’s sixth argument is the value if / is missing, so http://www.example.com still returns www.example.com. That LET/TEXTBEFORE identity matches the six rows above when implemented with the same substitutions. It still keeps subdomains.
Regex and new URL().hostname
In JavaScript, the thorough parse for a string that really is a URL is the URL constructor:
const host = new URL("https://blog.example.co.uk/a?b=1").hostname;
// "blog.example.co.uk"
new URL("example.org/path") throws because there is no scheme. Wrap bare hosts with https:// first, or fall back to the regex. FlashKit does not call new URL; it only runs the regex. Python: urllib.parse.urlparse(value).hostname with the same scheme caveat.
The public suffix problem: blog.example.co.uk → example.co.uk
Registrable domain is not “everything after the first dot.” co.uk is a public suffix. The registrable domain of blog.example.co.uk is example.co.uk, not co.uk and not blog.example.co.uk. FlashKit keeps blog.example.co.uk. To reduce a list, use a Public Suffix List library — tldts or psl in Node, or the list at publicsuffix.org. Do not hand-roll “drop the first label” on mixed ccTLDs.
Dedupe and sort
The extractor already lowercases and de-duplicates, first-seen order. It will not merge www.example.com with example.com. If you want that merge, drop a leading www. in the sheet after extract, then UNIQUE. Sort with SORT in Sheets or sort -u on a Unix box. For a page of <a href> only, the href links extractor is the better first pass — it looks for anchors, then you run those URLs through this domain extractor.
Ports never appear because the regex stops at the hostname shape; example.com:8080 still yields example.com plus a leftover that may not match. Userinfo (https://user:pass@host/) is not stripped by a URL parser here — new URL would drop it, the regex will not see user as a host unless it has a dot. Internationalized labels in Unicode often fail the [a-z0-9-] class; convert to ACE with the Punycode tool, then extract xn-- hosts. A crawler CSV with a header row named domain will not emit the word “domain” (no dot). A column of emails will emit the host after @ if that host has two labels — ada@blog.example.co.uk contributes blog.example.co.uk, which is why this is a bad spam-list builder and a fine log cleaner.
False positives worth a second look: report.pdf, index.html if someone omitted the slash, dotted IPv4, s3.amazonaws.com object hosts, tracking redirects like click.example.net. False negatives: single-label intranet names (intranet), IPv6 literals, and hosts in javascript: or data: URLs. After you have a unique list, resolving it is the other guide: find the IP of a domain. Do not point a resolver at names you are not allowed to look up.
Worked paste, again, because the tool is easy to over-trust. Input the four example lines plus https://www.example.com/x and http://sub.example.org. Unique hosts: blog.example.co.uk, www.example.com, example.org, report.pdf, 192.0.2.33, sub.example.org. www.example.com appears once even though it showed up twice. example.com without www is not in the list unless you paste it. That is url-to-domain extraction as implemented, not a CRM “company domain” cleaner. If you need the registrable domain, pipe the unique list through tldts.getDomain (or the psl package) in a local script. Do not paste customer PII into a random website’s extractor; FlashKit’s runs locally, but the habit should be local-first for any paste that includes emails or tokens.
Excel without REGEXEXTRACT: strip https:// and http:// with SUBSTITUTE, then TEXTBEFORE the first /, as in the LET formula above. It still keeps subdomains. A Power Query “parse URI” step is the thorough Excel path if you have it. Neither Excel nor Sheets applies the Public Suffix List. Root domain from subdomain is always a PSL step. The FlashKit domain extractor will not grow that step in this PR; if the regex matching report.pdf bothers you, filter the output rather than expecting the widget to know file extensions from TLDs.
Copy the unique box, paste into a sheet, SORT, and skim. That is the whole online domain name extractor workflow. The thorough option for a URL that really is a URL remains new URL(value).hostname in a script you run on files you already hold. FlashKit’s paste box is for messy text, not for a 10-million-row crawl dump — the regex will freeze a huge paste; chunk it. Extract domains from text, then stop. DNS is the other post. Email lists belong in the email extractor; this page is hosts only. Backlink CSVs, access logs, and partner spreadsheets are the three pastes this regex is for.
Then resolve the unique hosts
Domain-to-IP converter looks up A/AAAA. Do not query names you are not allowed to resolve.
Open domain-to-IP