AI Content Creation

How to Extract the Domain From a URL in Google Sheets

You have a column of messy URLs. You need the clean domain. Here is the painful old way, and the one-line way.

By FITS TeamJuly 13, 20263 min read

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.

Stop Wrestling With Regex

FITS brings plain-English AI formulas straight into Google Sheets. Describe what you want. Get the answer. Free tier included.