When you visit a website, you may notice the URL in the search bar changes slightly based on your location on the site or which web page you’re viewing.

For example, you can visit hubspot.com to view and access the tools and services offered. Or, you can visit blog.hubspot.com to access the section of our website that serves blog content. Although the URL changes slightly, you’re still on HubSpot’s website, under HubSpot’s domain.

In this article, we’ll look at the part of the URL that does change — called the subdomain — and why exactly that is.

Download Now: Free Intro Guide to HTML & CSS

A domain name typically has two parts: The top-level domain (TLD) is the extension, such as .com or .org, and the second-level domain (SLD) is the unique part of the domain name, often a business or brand name. In the hubspot.com example, com is the TLD and hubspot is the SLD.

The subdomain is what goes before the SLD. The most common subdomain is www, which stands for World Wide Web. This subdomain contains a website’s homepage and its most important pages. The www subdomain is so widely used that most domain registrars include it with domain name purchases.

Subdomains are also commonly used to separate a section of a website from the main site. For example, blog.hubspot.com and shop.hubspot.com direct to our blog and online store respectively.

When we group our domain name and subdomain with a protocol at the beginning (HTTP or HTTPS for websites) and an optional file path at the end, we have a complete URL:

anatomy of a web address containing a subdomain

What is a subdomain used for?

Subdomains make it simple for you to organize the various functions of your website, while also making it easier for users to find these different functions.

Think about it this way: If you’re hosting a party, you need to provide guests with your address. The TLD would be the city you live in while the SLD would be your number and street name. If you live in an apartment building, you need to get even more specific so your guests know which apartment to ring. Your apartment number would be akin to a subdomain — a specific section of the greater building that's dedicated to your living space.

If you plan to add more functions to your website, such as a store, a forum, or a blog, you might add a subdomain to your domain to separate these functions off from your main website.

You can also use subdomains to create localized content. For example, if you run a restaurant chain with multiple locations, customers can visit www.myrestaurant.com for all-encompassing content. Or, customers looking for the menu at your Nashville, Tennessee location can access this information via nashville.myrestaurant.com.

Subdomain Examples

If you’re looking to create a subdomain on your website but aren’t sure what that would look like, refer to the www.hubspot.com and blog.hubspot.com example mentioned above.

By separating the HubSpot Blog from the rest of the website, it makes it obvious to visitors where they’re located on the HubSpot website as a whole. This is helpful considering www.hubspot.com focuses on the HubSpot product line, while blog.hubspot.com contains articles that don’t necessarily relate to HubSpot products. Separating the two from each other with a subdomain keeps everything organized and helps visitors find what they need.

example of a subdomain on hubspot.com

Here’s another example: In addition to its online store that sells new products, outdoor clothing brand Patagonia also resells its used clothing through the Worn Wear program. When we visit both of these links, we see that www.patagonia.com encompasses the Patagonia store (as well as other initiatives by the brand) and that wornwear.patagonia.com is used for the Worn Wear section.

example of a subdomain on patagonia.com

Websites can use subdomains in other ways too, like to denote language or region. Wikipedia does this with its articles. For instance, the en subdomain means the article is written in English, es indicates Spanish, and so on.

example of a subdomain on wikipedia.com

Here’s a fun subdomain trick: Try replacing the subdomain for a Wikipedia article with simple. You may see a simplified English version of the article for those learning the language and those with different needs.

example of a subdomain on wikipedia.com

Now let’s take a look at how you can go about creating a subdomain on your own website.

No matter what you want to use your subdomain for, you can create one with the help of your web hosting provider.

For example, HubSpot's CMS, CMS Hub — which you can test out with a free 14-day trial — makes it easy to host your content on one subdomain per content tool you use (e.g. blog, landing page, website page) for one brand domain.

It’s important to note that these features are specific to HubSpot’s CMS. Your hosting provider as well as the service through which you obtained your domain name are unique.

On that same token, as we work through the following steps, keep in mind that they may differ slightly depending on your service.

1. Name your subdomain.

First, think of a subdomain name that best fits the section of the site you’re assigning. Common subdomains include blog, store, shop, support, help, and events.

There’s no need to overthink this — pick a name that succinctly describes this part of your site, and limit it to one word if you can. That way, your URL will look clean and familiar to visitors, even with the extra name tacked on.

2. Log into your cPanel.

To begin creating your subdomain, log into your hosting provider’s file manager, which is likely to be cPanel. Every hosting provider has a unique login and setup for their cPanel, but your screen should look something like this.

login to your cpanel to create a subdomain

Image Source

3. Navigate to and enter your subdomain.

Now you’ll want to navigate to Subdomains or Add Subdomains. Here you can begin to enter your subdomain of choice. Add the subdomain, and be sure your primary domain name is selected as well.

Navigate to and enter your subdomain name in your cpanel

Image Source

4. Create a new DNS record.

Once the domain is created, you’ll need to add a new domain name system (DNS) record. Navigate to DNS and select Add (or a similar command). Select what you want your subdomain to connect to, whether it’s an IP address, an IP address connected to the destination hostname, a server name, or a wildcard domain.

Add DNS to create a subdomain

Image Source

5. Click Create and wait for your subdomain to resolve.

Finally, click Create, or a similar commend, and wait for your subdomain to resolve. It typically takes anywhere from 30 minutes to 24 hours for your subdomain to be implemented and functional on your website.

Add a subdomain to your site

If you’re unsure as to whether you should publish a particular page under your www subdomain or under a different subdomain, think about the primary goals of your website. Pages related to this goal should fall under www, and consider placing other pages under a custom subdomain if there are enough to make up a substantial part of your site. A collection of a few pages probably doesn’t need its own subdomain.

For example, if you run an online store and write the occasional blog post, you can use www.mywebsite.com for your store and blog.mywebsite.com for your blog section. Conversely, if you mainly publish a blog and sell some merch on the site, use www.mywebsite.com for your blog and store.mywebsite.com for the ecommerce side.

By implementing subdomains on your website, you can create separate sections of content and services for your website without having to create new domain names for each part. Subdomains will also make it easier for users to find what they need, all in one place. If it improves your visitors’ experience, it’s likely a step worth taking.

New Call-to-action

 css introduction

Originally published Feb 12, 2021 7:00:00 AM, updated February 12 2021

Topics:

Web Hosting