keepcalculator

06 Numbers and Powers

Get Domain from Email Address? How to Extract It

Card No. 06·71149 · Updated · Standard formula, shown below

The calculator on this card is switched off while it is checked. The formula is below, and the worked example shows how to do the sum by hand.

To get the domain from an email address, you take everything after the “@” symbol — for example, in john.doe@example.com, the domain is example.com. This quick extraction is useful for sorting contacts, filtering spam, or analyzing which companies or providers your emails come from.

Formula

The formula to extract a domain from an email address is simple: Domain = the substring of the email that starts right after the “@” character.

In plain words: find the position of the “@” symbol in the email string, then take every character that comes after it. The result is the domain part.

For an email like user@domain.com, the domain is domain.com. The formula works for any valid email address because every email address must contain exactly one “@” symbol that separates the local part (the username) from the domain part.

Worked Example

Let’s use the default email address from the calculator: john.doe@example.com

  1. Find the position of the “@” symbol. In john.doe@example.com, the “@” is at position 9 (counting from 1).
  2. Take everything after position 9: example.com

The result is example.com, which is exactly what the calculator shows.

What Exactly Is an Email Domain?

An email address has two main parts separated by the “@” symbol:

  • Local part (before the @): the username or mailbox name, like john.doe or support.
  • Domain part (after the @): the mail server’s domain, like gmail.com or company.org.

The domain part itself can include subdomains. For example, in user@mail.company.com, the full domain is mail.company.com, but the registered domain (the part you’d own or register) is company.com. Depending on your purpose, you might want the full domain or just the registered domain.

Why Would You Need to Extract a Domain?

There are several common reasons to pull the domain from an email address:

  • Sorting contacts by company — if you have a list of emails, grouping by domain can help you see which organizations they belong to.
  • Filtering spam or newsletters — you can block or prioritize emails from specific domains.
  • Analyzing email lists — for marketing or data cleanup, you might want to count how many emails come from free providers (like gmail.com) versus corporate domains.
  • Identifying the email provider — domains like outlook.com or yahoo.com tell you which service the person uses.

How to Do It Manually or with Tools

You don’t always need a calculator to get the domain. Here are a few ways:

  • By eye: Just look for the “@” and copy everything after it. For a handful of emails, this is fastest.
  • In Excel or Google Sheets: Use a formula like =RIGHT(A1, LEN(A1) - FIND("@", A1)) to extract the domain from cell A1.
  • In programming: In Python, you can use email.split('@')[1]; in JavaScript, email.split('@')[1] works the same way.
  • Online tools: Many free web tools let you paste a list of emails and get back the domains in bulk.

For a single email, the calculator above does the job instantly. For a whole list, a spreadsheet formula or a small script is more efficient.

Common Mistakes and Edge Cases

While extracting a domain is straightforward, there are a few pitfalls:

  • Multiple @ symbols: A valid email address can only have one “@”. If you see more than one, the address is invalid. The formula above takes everything after the first “@”, which may not be what you want for malformed input.
  • Trailing dots or spaces: Some email addresses have a dot at the end (e.g., user@example.com.). That trailing dot is not part of the domain; you may want to strip it.
  • Subdomains: As mentioned, mail.company.com is different from company.com. Decide which one you need.
  • Case sensitivity: Domain names are case-insensitive, so EXAMPLE.COM and example.com are the same. The extraction works regardless, but you might want to convert to lowercase for consistency.

What About the Registered Domain (eTLD+1)?

Sometimes you don’t want the full domain but the registered domain — the part that you actually own or that identifies the organization. For example, from user@mail.company.co.uk, the full domain is mail.company.co.uk, but the registered domain is company.co.uk.

To get the registered domain, you need a list of public suffixes (like .com, .co.uk, .org.au) and then take the last two parts that are not in that list. This is called the “eTLD+1” (effective top-level domain plus one). Many programming libraries (like Python’s tldextract) do this automatically.

For most casual uses, the full domain is fine. But if you’re analyzing company affiliations, you’ll want the registered domain to avoid counting mail.company.com and shop.company.com as different entities.

Frequently Asked Questions

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

In Excel, you can use the formula =RIGHT(A1, LEN(A1) - FIND("@", A1)) where A1 contains the email. This finds the position of the “@” and returns all characters after it. For a column of emails, drag the formula down.

What is the difference between domain and email provider?

The domain is the part after the “@”. The email provider is the service that hosts the mailbox. For example, gmail.com is both a domain and a provider. But if someone uses a custom domain like @mycompany.com, the provider might be Google Workspace or Microsoft 365 behind the scenes, but the domain is still mycompany.com.

Can I get the domain from an email address without a calculator?

Yes. For a single address, just look at the text and copy after the “@”. For a list, you can use a spreadsheet formula, a text editor with find-and-replace, or a small script. The calculator here is mainly for quick, one-off checks.

What if the email address has a subdomain like mail.company.com?

Then the extracted domain is mail.company.com. If you want the registered domain (company.com), you need to apply an algorithm that knows public suffixes. Many online tools and programming libraries can do this.

Why does my extracted domain have a trailing dot?

Some email addresses are written with a trailing dot (e.g., user@example.com.). This is technically a fully qualified domain name, but it’s rarely used in practice. If you see it, simply remove the final dot to get the standard domain.

Is the domain part of an email always after the last @?

No, it’s after the first and only “@”. A valid email address has exactly one “@”, so the domain is everything after that single symbol. If there are multiple “@”, the address is invalid.

Related

Formula used
in email | Email address | - | john.doe@example.com | 0
out domain | Domain | - | substr(email, find(email, "@") + 1) | 0

Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.

More cards in this drawer

The whole Numbers and Powers drawer →