Text
Extract the final domain label (.com, .org, .uk) from simple URLs and emails
Isolate a simple hostname, then extract its last dot-separated label with TEXTAFTER.
Isolate the hostname before searching for the last dot
Searching directly for the last "." in "https://site.com/docs/v2.1/report.pdf" grabs ".pdf" instead of ".com"! Always strip protocol "://", email "@", and URL path "/" first to isolate the clean hostname.
Once you have the hostname ("sheets.arte-soft.com"), "." & TEXTAFTER(host, ".", -1) extracts the final TLD (".com").
| Input (A) | Clean Host | Final TLD | 2-Part Suffix |
|---|---|---|---|
| https://sheets.arte-soft.com/pricing | sheets.arte-soft.com | .com | .arte-soft.com |
| ops@portal.gov.uk | portal.gov.uk | .uk | .gov.uk |
Simple URL-and-email suffix formula
Chaining IFERROR(TEXTAFTER(u, "://"), u) and IFERROR(TEXTAFTER(..., "@"), ...) normalizes bare domains, full URLs, and email addresses in one pipeline.
=LET(s, LOWER(TRIM(A2)), p, IFERROR(TEXTAFTER(s, "://"), s), e, IFERROR(TEXTAFTER(p, "@"), p), h, IFERROR(TEXTBEFORE(e, "/"), e), "." & TEXTAFTER(h, ".", -1))Last two labels, not a public-suffix lookup
Passing -2 to TEXTAFTER(h, ".", -2) extracts the last two dot-separated labels (".gov.uk").
=LET(s, LOWER(TRIM(A3)), e, IFERROR(TEXTAFTER(s, "@"), s), "." & TEXTAFTER(e, ".", -2))Inputs and interpretation
These examples assume a simple DNS hostname without a port, query, fragment, trailing dot, credentials, or IP literal. They are not a general URL/email validator. The last two labels are not necessarily a public suffix: arte-soft.com includes a registrable domain, while gov.uk is a different kind of suffix. Use a maintained Public Suffix List library to identify registrable domains rather than guessing from label count.
Try the example
Use the original values or change them to test your understanding.