Skip to content

How to Trim URLs to Root Domains in Google Spreadsheet, Excel, and Notepad++

URLs, or Uniform Resource Locators, are essential elements of the web. They provide a unique address for each resource on the internet. However, when working with URLs, you might often find it necessary to extract the root domain from a complete URL. Whether you’re analyzing website data, conducting research, or organizing information, knowing how to trim URLs to their root domains can be incredibly useful. In this article, we’ll explore how to extract the domain from a URL in Google Spreadsheet, Excel, and Notepad++.

1. Google Spreadsheet:

Google Spreadsheet is a powerful cloud-based spreadsheet tool that offers various functionalities, including data manipulation. To extract the domain from a URL in Google Spreadsheet, you can use the following steps:

Step 1: Open your Google Spreadsheet and navigate to the cell where you want to extract the domain.

Step 2: Enter the following formula in the cell:

=REGEXEXTRACT(A1,”^(?:https?:\/\/)?(?:www\.)?([^\/]+)”)

Replace `A1` with the cell reference containing the URL from which you want to extract the domain.

Step 3: Press Enter, and the cell will display the root domain extracted from the URL.

2. Microsoft Excel:

Microsoft Excel is a widely used spreadsheet application that provides robust data manipulation capabilities. To trim URLs to their root domains in Excel, you can follow these steps:

Step 1: Open your Excel worksheet and navigate to the cell where you want to extract the domain.

Step 2: Enter the following formula in the cell:

=LEFT(MID(A1,FIND(“//”,A1)+2,LEN(A1)),FIND(“/”,MID(A1,FIND(“//”,A1)+2,LEN(A1)))-1)

Replace `A1` with the cell reference containing the URL you wish to extract the domain from.

Step 3: Press Enter, and the cell will display the root domain extracted from the URL.

3. Notepad++:

Notepad++ is a popular text editor with powerful features, including regular expression-based search and replace. To extract the domain from a URL in Notepad++, you can follow these steps:

Step 1: Open Notepad++ and paste the URLs containing the domains you want to extract.

Step 2: Press `Ctrl + H` to open the Find and Replace dialog box.

Step 3: In the “Find what” field, enter the following regular expression:

^https?:\/\/(?:www\.)?([^\/]+)

Step 4: Leave the “Replace with” field empty.

Step 5: Enable the “Regular expression” search mode.

Step 6: Click on the “Replace All” button.

Notepad++ will replace all the URLs in the document with their respective root domains.


Trimming URLs to their root domains can simplify data analysis and organization tasks. By extracting only the domain part, you can focus on higher-level analysis and gain insights into the web landscape more efficiently. Whether you’re using Google Spreadsheet, Excel, or Notepad++, these methods will help you extract the root domains from URLs and streamline your workflow.

Remember that extracting the domain using simple string manipulations might not always work perfectly, especially when dealing with complex URLs. In such cases, you may need to resort to more advanced techniques or use dedicated programming languages for precise domain extraction.

While there are traditional methods to achieve this using Google Spreadsheet, Excel, and Notepad++, there’s an alternative approach that offers convenience and simplicity. Introducing the Online Text Tool for Trimming URLs to Root Domains which you can access and trim your urls to domain online and also our popular tool for extract the urls from text.

Now that you’re equipped with the knowledge of extracting root domains from URLs, go ahead and enhance your data analysis, research, and organization capabilities!