{"id":453,"date":"2026-11-05T19:04:42","date_gmt":"2026-11-05T19:04:42","guid":{"rendered":"https:\/\/easyextract.online\/blog\/how-to-extract-domains-from-urls-and-text\/"},"modified":"2026-11-05T19:04:42","modified_gmt":"2026-11-05T19:04:42","slug":"how-to-extract-domains-from-urls-and-text","status":"publish","type":"post","link":"https:\/\/easyextract.online\/blog\/how-to-extract-domains-from-urls-and-text\/","title":{"rendered":"How to Extract Domains &#038; Hostnames from URLs and Text Online"},"content":{"rendered":"<p><strong>To extract clean root domains or Fully Qualified Domain Names (FQDNs) from a list of URLs, email addresses, or log files without breaking on multi-part country TLDs like <code>.co.uk<\/code> or <code>.com.au<\/code>, parse the hostnames and strip protocols, ports, paths, and `www.` prefixes directly in your browser using the <a href=\"https:\/\/easyextract.online\/domain-extractor\/\">EasyExtract Domain Extractor<\/a>. Everything runs 100% client-side in local RAM with zero server uploads, outputting a deduplicated domain list ready for SEO backlink audits, firewall allowlists, or DNS lookups.<\/strong><\/p>\n<p>SEO specialists auditing 50,000 backlink URLs, cybersecurity engineers compiling DNS sinkhole blocklists from proxy logs, and B2B outreach teams deduplicating prospect websites all face the same problem: converting messy URLs like `https:\/\/app.staging.example.co.uk:8443\/login?ref=123` into clean, normalized domain names (`example.co.uk` or `app.staging.example.co.uk`).<\/p>\n<p>This guide explains why simple Excel `MID`\/`FIND` formulas and naive `.split(&#8216;.&#8217;)` scripts fail on real-world domains and shows you how to extract and normalize domains accurately.<\/p>\n<h2>Root Domain (eTLD+1) vs. Subdomain (FQDN): Why `.co.uk` Breaks Naive Formulas<\/h2>\n<p>Under <strong>RFC 1035<\/strong> and Mozilla&#8217;s <strong>Public Suffix List (PSL)<\/strong>, a URL&#8217;s hostname consists of multiple dot-separated labels read from right to left:<\/p>\n<ul>\n<li><strong>Top-Level Domain (TLD \/ Public Suffix):<\/strong> While generic TLDs like `.com`, `.org`, and `.io` occupy a single label, dozens of major country-code second-level domains (**ccSLDs**) occupy **two labels**\u2014such as `.co.uk` (United Kingdom), `.com.au` (Australia), `.co.jp` (Japan), `.com.br` (Brazil), and `.co.in` (India).<\/li>\n<li><strong>Registrable Root Domain (`eTLD+1` \/ Apex Domain):<\/strong> The public suffix plus one preceding label (for example, `bbc.co.uk` or `stripe.com`). If a naive script simply grabs the &#8220;last two dot-separated words&#8221; (`hostname.split(&#8216;.&#8217;).slice(-2).join(&#8216;.&#8217;)`), it turns `shop.tesco.co.uk` into **`co.uk`**\u2014destroying your dataset!<\/li>\n<li><strong>Fully Qualified Domain Name (FQDN \/ Hostname):<\/strong> Includes all subdomains (such as `api.v2.stripe.com`), excluding the `https:\/\/` scheme, `:port`, and `\/path`.<\/li>\n<\/ul>\n<h2>Method 1: Extract &amp; Deduplicate Domains Online in Your Browser (Zero Uploads)<\/h2>\n<p>To strip thousands of URLs, email addresses, or raw text logs down to unique domains in under a second:<\/p>\n<ol>\n<li>Open the free <a href=\"https:\/\/easyextract.online\/domain-extractor\/\"><strong>Domain Extractor<\/strong><\/a> on EasyExtract.<\/li>\n<li>Paste your list of URLs, HTML snippets, or raw log text into the input box.<\/li>\n<li><strong>Choose Subdomain &amp; `www.` Handling:<\/strong> Toggle whether to strip `www.` prefixes, whether to collapse subdomains down to the registrable root domain (`eTLD+1`), and whether to deduplicate and sort alphabetically.<\/li>\n<li>Click <strong>Copy Domains<\/strong> or download the clean list as a `.txt` or `.csv` file.<\/li>\n<\/ol>\n<table>\n<thead>\n<tr>\n<th>Input String<\/th>\n<th>Full Hostname (FQDN)<\/th>\n<th>Root Domain (`eTLD+1`)<\/th>\n<th>Naive Excel Formula Output (Broken)<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>https:\/\/www.stripe.com\/docs\/api?v=2<\/code><\/td>\n<td><code>www.stripe.com<\/code><\/td>\n<td><code>stripe.com<\/code><\/td>\n<td><code>www.stripe.com<\/code><\/td>\n<\/tr>\n<tr>\n<td><code>https:\/\/portal.nhs.uk:8080\/login<\/code><\/td>\n<td><code>portal.nhs.uk<\/code><\/td>\n<td><code>nhs.uk<\/code><\/td>\n<td><code>portal.nhs.uk:8080<\/code> (keeps port)<\/td>\n<\/tr>\n<tr>\n<td><code>https:\/\/store.Waitrose.co.uk\/offers<\/code><\/td>\n<td><code>store.waitrose.co.uk<\/code><\/td>\n<td><code>waitrose.co.uk<\/code><\/td>\n<td><code>co.uk<\/code> (truncates brand!)<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>Method 2: Extract Domains in Microsoft Excel &amp; Google Sheets<\/h2>\n<p>If you need a quick formula inside a spreadsheet to strip `http:\/\/`, `https:\/\/`, `www.`, and everything after the first `\/` slash:<\/p>\n<h3>Google Sheets `REGEXEXTRACT` Formula (Best for Sheets)<\/h3>\n<pre><code>=LOWER(REGEXEXTRACT(A2, \"^(?:https?:\/\/)?(?:www\\.)?([^\/:?#]+)\"))<\/code><\/pre>\n<h3>Microsoft Excel Formula<\/h3>\n<pre><code>=LOWER(SUBSTITUTE(MID(A2, FIND(\"\/\/\", A2)+2, FIND(\"\/\", A2&\"\/\", FIND(\"\/\/\", A2)+2) - FIND(\"\/\/\", A2) - 2), \"www.\", \"\"))<\/code><\/pre>\n<h2>Related Network &amp; URL Extraction Tools<\/h2>\n<p>Pair the Domain Extractor with our companion network and SEO utilities in the <a href=\"https:\/\/easyextract.online\/text-extraction\/\">Text &amp; Pattern Extraction Hub<\/a>:<\/p>\n<ul>\n<li><a href=\"https:\/\/easyextract.online\/url-extractor\/\"><strong>URL Extractor<\/strong><\/a> \u2014 Pull complete `http:\/\/` and `https:\/\/` links out of raw text before filtering domains.<\/li>\n<li><a href=\"https:\/\/easyextract.online\/dns-record-extractor\/\"><strong>DNS Zone File &amp; Record Extractor<\/strong><\/a> \u2014 Parse BIND zone files and extract `A`, `AAAA`, `CNAME`, `MX`, and `TXT` records.<\/li>\n<li><a href=\"https:\/\/easyextract.online\/ip-address-extractor\/\"><strong>IP Address Extractor<\/strong><\/a> \u2014 Extract IPv4 and IPv6 addresses from server logs alongside domains.<\/li>\n<li><a href=\"https:\/\/easyextract.online\/email-extractor\/\"><strong>Email Address Extractor<\/strong><\/a> \u2014 Pull email addresses and group them by recipient domain.<\/li>\n<\/ul>\n<h2>Frequently Asked Questions<\/h2>\n<h3>Can the Domain Extractor pull domains out of email addresses too?<\/h3>\n<p>Yes. When your text contains email addresses (`support@company.io`) alongside web URLs (`https:\/\/blog.company.io\/post`), the extractor isolates the domain portion after `@` as well as URL hostnames.<\/p>\n<h3>Does it remove port numbers like `:8080` or `:443`?<\/h3>\n<p>Yes. Port numbers, URL paths (`\/path`), query strings (`?id=1`), and hash fragments (`#top`) are automatically stripped so only valid DNS hostnames remain.<\/p>\n<h3>Are my backlink lists or firewall logs uploaded to a server?<\/h3>\n<p>Never. All hostname parsing and deduplication happen 100% locally in your browser&#8217;s RAM.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>To extract clean root domains or Fully Qualified Domain Names (FQDNs) from a list of URLs, email addresses, or log files without breaking on multi-part country TLDs like .co.uk or .com.au, parse the hostnames\u2026<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"slim_seo":{"title":"Extract Domains from URLs & Text Online (Root Domain Guide)","description":"Extract root domains (eTLD+1) and subdomains from messy URL lists, logs, and emails in your browser. Handles .co.uk and multi-part TLDs with zero uploads."},"footnotes":""},"categories":[3],"tags":[],"class_list":["post-453","post","type-post","status-publish","format-standard","hentry","category-guides"],"_links":{"self":[{"href":"https:\/\/easyextract.online\/blog\/wp-json\/wp\/v2\/posts\/453","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/easyextract.online\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/easyextract.online\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/easyextract.online\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/easyextract.online\/blog\/wp-json\/wp\/v2\/comments?post=453"}],"version-history":[{"count":0,"href":"https:\/\/easyextract.online\/blog\/wp-json\/wp\/v2\/posts\/453\/revisions"}],"wp:attachment":[{"href":"https:\/\/easyextract.online\/blog\/wp-json\/wp\/v2\/media?parent=453"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/easyextract.online\/blog\/wp-json\/wp\/v2\/categories?post=453"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/easyextract.online\/blog\/wp-json\/wp\/v2\/tags?post=453"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}