Extracting a domain sounds simple. It is not. A URL can start with http or https. It might have a www. It might have a path, a port, or a query string. You want just the domain. Google Sheets makes you fight for it.
This is a common job for marketers and sales teams. You dedupe lead lists by company. You map referral traffic. You group backlinks by site. All of it starts with a clean domain.
The Old Way (Regex or String Soup)
Most guides hand you a wall of REGEXEXTRACT. It matches the protocol, skips the www, then grabs everything up to the first slash.
=REGEXEXTRACT(A2, "^(?:https?:\/\/)?(?:www\.)?([^:\/\n]+)")No regex? Then you nest SUBSTITUTE inside LEFT inside FIND and hope for the best.
=LEFT(SUBSTITUTE(SUBSTITUTE(A2,"http://",""),"https://",""), FIND("/", SUBSTITUTE(SUBSTITUTE(A2,"http://",""),"https://","")&"/")-1)Both break on the first weird URL. A missing protocol returns garbage. A trailing space throws an error. And nobody can read them a week later.
The FITS Way (Plain English)
With FITS installed, you describe the result. The AI handles the parsing.
=FITS("Extract the clean root domain from " & A2)Want to keep the subdomain but drop the www? Just say so. No new formula to memorize.
=FITS("Get the domain from " & A2 & ", remove www but keep other subdomains")Missing protocols, trailing spaces, odd ports. The AI reads intent, not just characters. Your sheet stops returning walls of #N/A.
When to Use Each
Use REGEXEXTRACT when your URLs are perfectly clean and identical. Use =FITS() when they are messy, varied, or human-entered (which is almost always). See more copy-paste examples in our AI formulas for content marketers guide, or dig into messy data extraction in Google Sheets. Domain parsing is one of many jobs regex used to own. The same approach will extract an email address out of freeform text. Our full guide to automating Google Sheets tasks you used to need regex for covers extraction, cleanup, and categorization in one place. Two neighbouring jobs use the same one-liner: getting a person name out of an email address, and extracting the text sitting between two characters. This page assumes the cell already holds a URL. If the link is buried in a sentence instead, start with extracting a URL from text, since the standard regex drags the closing bracket along with it. If the cell shows a word rather than an address, the address is rich text metadata and REGEXEXTRACT returns #N/A, so extract the URL from the hyperlink first. Having the URL is not the same as being able to read the page behind it, which is the wall described in extracting Zillow data into Google Sheets.
Stop Wrestling With Regex
FITS brings plain-English AI formulas straight into Google Sheets. Describe what you want. Get the answer. Free tier included.