Back to Blog

How to Extract Domain Names from a List of URLs (The Easy Way)

ToolsForTexts TeamUpdated April 9, 20265 min read
🔧

Free Tool

Domain Extractor Online — Extract Domains from URLs & Text

Use our free online domain extractor tool to instantly extract domains from text, URLs, or emails. Easily parse bulk links, strip subdomains, and export to CSV or TXT.

If you've ever needed to pull a clean list of domain names from a messy pile of URLs, you already know the pain. Maybe you're cleaning up a backlink export, auditing internal links, or sorting through thousands of rows of scraped data.

The good news? Extracting domains doesn't have to mean writing Python scripts or wrestling with spreadsheet formulas. Here's everything you need to know — from the fast no-code way to the developer approach.

What Is Domain Extraction?

Domain extraction is the process of pulling just the root domain (like example.com) from a full URL like https://blog.example.com/article/how-to-do-something?utm_source=twitter.

Typically, you don't care about the protocol (https://), the subdomain (blog.), the path (/article/...), or query parameters (?utm_source=...). You just want the clean domain.

Why You Might Need to Extract Domains

For SEO Professionals

  • Building a deduplicated list of referring domains from a link export
  • Comparing competitor backlink profiles domain by domain
  • Cleaning up a disavow file before submitting to Google Search Console
  • Identifying which domains link to you multiple times

For Marketers

  • Cleaning a lead list that contains full URLs instead of just company websites
  • Segmenting email outreach campaigns by company domain
  • Analyzing which traffic sources or partner domains drive the most conversions

For Developers

  • Parsing API responses that return full URLs
  • Normalizing and deduplicating data before inserting into a database
  • Filtering access logs, error logs, or analytics exports by host
[@portabletext/react] Unknown block type "adBanner", specify a component for it in the `components.types` prop

Method 1: Use a Free Online Tool (Fastest — No Code)

For a one-off job or when you don't want to write code, use the Domain Extractor tool on ToolsForTexts. Here's how:

  • Step 1: Copy your URLs from anywhere — a spreadsheet, a CSV export, a text file, or a webpage.
  • Step 2: Paste them into the tool. It starts processing immediately.
  • Step 3: Toggle 'Include subdomains' if you want blog.example.com instead of just example.com.
  • Step 4: Choose your output format — plain list, CSV, or JSON.
  • Step 5: Click Copy or Download. Done.

No account, no installation, no API key. Handles tens of thousands of URLs instantly.

🔧Try Domain Extractor — free, no signup required

Method 2: Extract Domains in Python

If you need to process URLs programmatically or automate the extraction:

1from urllib.parse import urlparse
2
3urls = [
4 "https://blog.example.com/article?utm_source=twitter",
5 "http://www.another-site.org/page/",
6 "ftp://files.example.net/data.zip",
7]
8
9domains = set()
10for url in urls:
11 parsed = urlparse(url)
12 # Get just the root domain (strip www.)
13 domain = parsed.netloc.replace("www.", "")
14 if domain:
15 domains.add(domain)
16
17print(sorted(domains))
18# ['another-site.org', 'example.com', 'example.net']

Method 3: Extract Domains in JavaScript

1const urls = [
2 "https://blog.example.com/article?utm_source=twitter",
3 "http://www.another-site.org/page/",
4];
5
6const domains = [...new Set(urls.map(url => {
7 const { hostname } = new URL(url);
8 return hostname.replace(/^www\./, "");
9}))];
10
11console.log(domains);
12// ['example.com', 'another-site.org']

Method 4: Excel or Google Sheets Formula

If you prefer to work in a spreadsheet, this formula combination works for most URLs. Paste your URL in column A and use this in column B:

1=IFERROR(
2 SUBSTITUTE(
3 MID(A1, FIND("://", A1) + 3, FIND("/", A1 & "/", FIND("://", A1) + 3) - FIND("://", A1) - 3),
4 "www.", ""
5 ),
6 A1
7)

Warning: spreadsheet formulas break on edge cases like URLs without protocols or unusual subdomains. For large datasets, the online tool or code approaches are more reliable.

Tips for Better Results

  • The tool handles http://, https://, ftp://, and even bare domains like example.com/page without needing to clean your input first.
  • For spreadsheets, use CSV output — paste directly into a cell and split by comma.
  • For developers, use JSON output — it gives you a clean array ready to use in code.
  • Duplicates are automatically removed. Even if the same domain appears 500 times, it only shows up once in the output.

Frequently Asked Questions

How many URLs can I paste at once?

The tool runs entirely in your browser with no server calls. It can handle tens of thousands of URLs without any slowdown. Cool!

Can I extract domains from HTML source code?

Yes. Paste raw HTML and the tool finds all domains referenced in anchor tags, image sources, script tags, and other elements.

Does it extract subdomains?

By default it returns the root domain (example.com). Toggle 'Include subdomains' to get blog.example.com instead.

What URL formats are supported?

http://, https://, ftp://, //example.com (protocol-relative), and bare domains like example.com/path all work.

Wrapping Up

Extracting domains from URLs sounds simple but wastes a surprising amount of time when done manually. With the right tool it takes less than 30 seconds — even for thousands of URLs.

🔧Extract domains from your URLs now — free and instant
🔧

Free Tool

Domain Extractor Online — Extract Domains from URLs & Text

Use our free online domain extractor tool to instantly extract domains from text, URLs, or emails. Easily parse bulk links, strip subdomains, and export to CSV or TXT.

domain extractorSEO toolsURL parsingweb utilities