How to Get a Domain from an Email: The Complete Guide

Spreadsheet formulas, a Python snippet and an enrichment workflow for turning email addresses into domains and company data.

var(--variable-yLy1gAThf)

Databar team

Written by the Databar team

Blog

— min read

How to Get a Domain from an Email: The Complete Guide

Spreadsheet formulas, a Python snippet and an enrichment workflow for turning email addresses into domains and company data.

var(--variable-yLy1gAThf)

Databar team

Written by the Databar team

Blog

— min read

Build your dream workflow with Databar today.

The domain of an email address is everything after the @. For jane@acme.com it's acme.com. That part takes one formula.

The work starts after that. A list of 500 emails will include Gmail addresses, subdomains like eu.acme.com, stray spaces and capital letters, and a few addresses that aren't valid at all. And the domain on its own only tells you so much. What most people want is the company behind it: name, size, industry, location.

This guide covers three ways to extract domains (spreadsheet, Python, enrichment), the edge cases that break naive extraction, and a workflow for turning an email into a usable company and contact record.

Method 1: Spreadsheet Formulas

Assuming the email is in cell A2.

Google Sheets:

=LOWER(REGEXEXTRACT(TRIM(A2), "@(.+)$"))
=LOWER(REGEXEXTRACT(TRIM(A2), "@(.+)$"))
=LOWER(REGEXEXTRACT(TRIM(A2), "@(.+)$"))
=LOWER(REGEXEXTRACT(TRIM(A2), "@(.+)$"))

Excel (Microsoft 365):

=LOWER(TEXTAFTER(TRIM(A2), "@", -1))
=LOWER(TEXTAFTER(TRIM(A2), "@", -1))
=LOWER(TEXTAFTER(TRIM(A2), "@", -1))
=LOWER(TEXTAFTER(TRIM(A2), "@", -1))

The -1 tells TEXTAFTER to use the last @ in the string, which matters for the rare address with more than one.

Any version of Excel or Sheets:

=LOWER(MID(TRIM(A2), FIND("@", TRIM(A2)) + 1, LEN(A2)))
=LOWER(MID(TRIM(A2), FIND("@", TRIM(A2)) + 1, LEN(A2)))
=LOWER(MID(TRIM(A2), FIND("@", TRIM(A2)) + 1, LEN(A2)))
=LOWER(MID(TRIM(A2), FIND("@", TRIM(A2)) + 1, LEN(A2)))

All three return the full domain after the @, trimmed and lowercased so Acme.com and acme.com group together. Wrap the formula in IFERROR(..., "") if some cells don't contain an @, otherwise you'll get errors in those rows.

Formulas are fine for a one-off list of a few hundred rows. They don't strip subdomains, flag personal addresses or tell you anything about the company.

Method 2: Python

For a pipeline, a CRM export with thousands of rows, or anything you'll run more than once, a short script is easier to maintain than a formula.

import tldextract  # pip install tldextract

PERSONAL_DOMAINS = {
    "gmail.com", "googlemail.com", "yahoo.com", "outlook.com", "hotmail.com",
    "live.com", "icloud.com", "me.com", "aol.com", "proton.me", "protonmail.com", "gmx.com",
}

def extract_domain(email):
    email = (email or "").strip().lower()
    if "@" not in email:
        return None
    domain = email.rsplit("@", 1)[1]
    return domain or None

def root_domain(domain):
    # sales.acme.co.uk -> acme.co.uk
    return tldextract.extract(domain).top_domain_under_public_suffix or None

email = "Jane.Doe@Sales.Acme.co.uk "
domain = extract_domain(email)        # "sales.acme.co.uk"
company_domain = root_domain(domain)  # "acme.co.uk"
is_personal = company_domain in PERSONAL_DOMAINS
import tldextract  # pip install tldextract

PERSONAL_DOMAINS = {
    "gmail.com", "googlemail.com", "yahoo.com", "outlook.com", "hotmail.com",
    "live.com", "icloud.com", "me.com", "aol.com", "proton.me", "protonmail.com", "gmx.com",
}

def extract_domain(email):
    email = (email or "").strip().lower()
    if "@" not in email:
        return None
    domain = email.rsplit("@", 1)[1]
    return domain or None

def root_domain(domain):
    # sales.acme.co.uk -> acme.co.uk
    return tldextract.extract(domain).top_domain_under_public_suffix or None

email = "Jane.Doe@Sales.Acme.co.uk "
domain = extract_domain(email)        # "sales.acme.co.uk"
company_domain = root_domain(domain)  # "acme.co.uk"
is_personal = company_domain in PERSONAL_DOMAINS
import tldextract  # pip install tldextract

PERSONAL_DOMAINS = {
    "gmail.com", "googlemail.com", "yahoo.com", "outlook.com", "hotmail.com",
    "live.com", "icloud.com", "me.com", "aol.com", "proton.me", "protonmail.com", "gmx.com",
}

def extract_domain(email):
    email = (email or "").strip().lower()
    if "@" not in email:
        return None
    domain = email.rsplit("@", 1)[1]
    return domain or None

def root_domain(domain):
    # sales.acme.co.uk -> acme.co.uk
    return tldextract.extract(domain).top_domain_under_public_suffix or None

email = "Jane.Doe@Sales.Acme.co.uk "
domain = extract_domain(email)        # "sales.acme.co.uk"
company_domain = root_domain(domain)  # "acme.co.uk"
is_personal = company_domain in PERSONAL_DOMAINS
import tldextract  # pip install tldextract

PERSONAL_DOMAINS = {
    "gmail.com", "googlemail.com", "yahoo.com", "outlook.com", "hotmail.com",
    "live.com", "icloud.com", "me.com", "aol.com", "proton.me", "protonmail.com", "gmx.com",
}

def extract_domain(email):
    email = (email or "").strip().lower()
    if "@" not in email:
        return None
    domain = email.rsplit("@", 1)[1]
    return domain or None

def root_domain(domain):
    # sales.acme.co.uk -> acme.co.uk
    return tldextract.extract(domain).top_domain_under_public_suffix or None

email = "Jane.Doe@Sales.Acme.co.uk "
domain = extract_domain(email)        # "sales.acme.co.uk"
company_domain = root_domain(domain)  # "acme.co.uk"
is_personal = company_domain in PERSONAL_DOMAINS

Two details worth copying. rsplit("@", 1) splits on the last @, so an odd local part won't throw it off. And the root domain comes from tldextract, which uses the Public Suffix List. Splitting on dots yourself breaks on suffixes like .co.uk or .com.au, where the "last two parts" rule gives you co.uk instead of the company.

The personal-domain set above is a starting point, not a complete list. Add the regional providers that show up in your data (for example web.de, yandex.ru, qq.com).

Method 3: Enrichment

Formulas and scripts give you a string. Enrichment gives you the company. You send the email (or the extracted domain) to a data provider and get back fields like company name, industry, employee count, headquarters, founded year and LinkedIn page. Email-level enrichment can also return the person: name, job title and LinkedIn URL.

This is the method to use when the domain is a means to an end, which it usually is. Lead routing needs company size. ICP scoring needs industry. Personalization needs to know what the company does.

Edge Cases That Break Naive Extraction

Personal email domains

Gmail, Yahoo, Outlook, iCloud and the like tell you nothing about an employer. Flag them before running company enrichment, because a company lookup on gmail.com can come back as Google, which is wrong for your purposes. Don't delete these contacts outright, though. A person-level lookup on the full email can sometimes still find where they work.

Subdomains

Addresses like jane@mail.acme.com or jane@us.acme.com should usually map to acme.com for company matching. Use a Public Suffix List based library (as in the Python example) instead of stripping everything before the second-to-last dot.

Country and brand domains

The same company can send mail from acme.com, acme.de and acmegroup.co.uk. Subsidiaries and acquired companies often keep their own domains for years. If you group contacts by domain for account-based work, check company names or LinkedIn company URLs from enrichment as well, so one account doesn't show up as three.

Plus addressing

jane+webinar@acme.com has the same domain as jane@acme.com, so extraction isn't affected. For deduplication, though, strip the +tag from the local part so the same person doesn't appear twice.

Invalid and disposable addresses

Form fills bring in typos (acme.con, gmial.com) and throwaway addresses. A quick DNS check tells you whether the domain can receive mail at all: if it has no MX record, don't enrich or email it. Disposable-address providers publish long, changing domain lists, so use a maintained list or a verification service rather than your own.

Catch-all domains

Some mail servers accept mail for any address at the domain. Extraction works normally, but email verification comes back as "accept all" or "unknown" instead of valid. Keep those contacts, but send to them carefully and watch bounces.

Workflow: From Email to an Enriched Record

Here's the order that tends to work for inbound leads, event lists and CRM backfills:

  1. Normalize. Trim, lowercase, remove duplicates.

  2. Extract the domain and derive the root domain.

  3. Flag personal and invalid domains. Personal addresses go to person-level lookup only. Domains without MX records get set aside.

  4. Enrich the company from the root domain: name, industry, headcount, location, LinkedIn URL.

  5. Enrich the person from the full email: name, title, seniority, LinkedIn URL.

  6. Verify the email before it goes into any sequence.

  7. Score and route. Compare company fields against your ICP and send matches to the right owner or sequence.

Steps 4 and 5 are where match rates vary most. Any single provider will miss some share of your list, and the misses aren't random: a provider strong on US tech companies may be thin on European manufacturers. Running several providers in sequence and stopping at the first valid result is the usual fix.

Doing This in Databar

In Databar the whole flow lives in one table. Import the emails (CSV, CRM sync or API), then add company enrichment (from the domain) and person enrichment (from the full email) as columns. Providers that support lookups from an email include People Data Labs and Snov.io, and you can put several into a waterfall so a miss from one provider falls through to the next. There's also a ready-made template that gets person and company data from an email only.

Email verification runs as another column, and results can sync back to HubSpot or Salesforce. If you'd rather stay in code, the same enrichments are available through the REST API and Python SDK. These are separate enrichment steps rather than one magic call, so you choose which fields you pay for.

Databar connects to 160+ data providers and only charges when a lookup returns data. Plans start at $99/month, and there's a 14-day trial if you want to run your own list through it.

Databar integrations

If you're cleaning up an existing CRM rather than processing new leads, our CRM data cleaning and hygiene playbook covers deduplication and normalization in more depth.

FAQ

How do I extract a domain from an email in Excel?

In Microsoft 365, use =TEXTAFTER(A2, "@", -1). In older versions, use =MID(A2, FIND("@", A2) + 1, LEN(A2)). Both return everything after the @.

How do I get the domain from an email in Google Sheets?

Use =REGEXEXTRACT(A2, "@(.+)$"), or =INDEX(SPLIT(A2, "@"), 2) for a simpler version that works when each address has a single @.

How do I find the company name from an email address?

Extract the domain, then run it through a company enrichment provider, which maps the domain to a company record. For personal addresses like Gmail, the domain won't help, so use a person-level lookup on the full email instead.

How do I remove personal emails from a list?

Extract the domain, then filter against a list of free email providers (gmail.com, yahoo.com, outlook.com, hotmail.com, icloud.com, aol.com and regional ones relevant to your market). Some enrichment and verification tools also return a free-email flag you can filter on.

Why does my domain extraction return "co.uk" instead of the company?

Because the code takes the last two dot-separated parts. Use a library that reads the Public Suffix List, such as tldextract in Python, which correctly returns acme.co.uk.

Build your dream workflow today

Start for free today · no credit card required

Build your dream workflow today

Start for free today · no credit card required

Build your dream workflow today

Start for free today · no credit card required