Guides Blogs 5 min read 808 words

What is a Subdomain?

A subdomain is a prefix added to a domain, such as blog.example.com. See how subdomains work, when to use them, and how they compare to subdirectories.

What a subdomain is

A subdomain is a prefix added in front of a domain name to create a separate address under it. In blog.example.com, blog is the subdomain, example is the domain name and com is the top-level domain. You do not register a subdomain separately: once you own example.com, you can create subdomains of it through your DNS provider or hosting account.

Subdomains are used to split a site into separate parts, such as a shop, a support area or a test copy of the site, without buying another domain. If you are new to domain structure, start with what is a domain.

The parts of an address

Read a domain from right to left, from most general to most specific:

  • Top-level domain: the last label, such as .com or .org. See top-level domains explained.
  • Domain name: the name you register, such as example.
  • Subdomain: anything added to the left of that, such as blog or shop. You can nest them, as in eu.shop.example.com.

Even www in www.example.com is a subdomain. It is a convention, not a requirement, and a site can work with or without it as long as DNS is set up for the names you want to use.

Subdomain blog in blog.example.com, with the registered domain example.com and top-level domain com.

Common uses

  • Blog: blog.example.com keeps frequently updated content apart from the main site.
  • Online store: shop.example.com can run on a different platform from the main site.
  • Support or help centre: support.example.com for documentation, FAQs or ticketing.
  • Forum or community: forum.example.com.
  • Staging or development: dev.example.com to test changes without touching the live site.
  • Language or region versions: fr.example.com or us.example.com.
  • Campaigns and events: a separate address for a launch or event.
  • Per-customer addresses: software that gives each user their own address, which usually relies on a wildcard subdomain.

Subdomain vs subdirectory

A subdirectory is a folder path on the same host, such as example.com/blog/. A subdomain is a separate hostname, such as blog.example.com. Both can serve the same kind of content. The practical differences are these:

  • Setup: a subdomain needs a DNS record and a place for the server to serve it from. A subdirectory is just a folder or route within the existing site.
  • Separation: a subdomain can point to a completely different server or application. A subdirectory normally lives on the same one.
  • Search Console: a Search Console Domain property covers the domain and all its subdomains. URL-prefix properties cover only their specified prefix, so separate properties can be useful for individual subdomains. See Google’s property documentation.

On SEO, Google's public position is that it does not prefer either. Search Engine Journal quotes the Google Search Central documentation: "You should choose whatever is easiest for you to organize and manage. From an indexing and ranking perspective, Google doesn't have a preference." Many SEO practitioners still prefer subdirectories for simplicity, but that is opinion rather than a Google rule. Pick the structure that suits your setup and keep it, since changing URL structure later takes time to settle in search.

How to create a subdomain

The exact screens depend on your host or DNS provider, but the process is the same in principle:

  1. Decide on the name, for example blog.
  2. In your DNS provider, add a record for that name. An A record points it at a server's IP address; a CNAME points it at another hostname. For Namecheap's own instructions, enter only the subdomain part (for example blog) in the Host field, not the full domain name. Our guides cover Namecheap and cPanel.
  3. If you host the site yourself or on shared hosting, tell the web server which folder or application serves that name. In cPanel and similar panels this is usually a "Subdomains" or "Domains" option. On Apache it is a virtual host with a ServerName.
  4. Wait for DNS to update. Namecheap states that new records normally take about 30 minutes to take effect, and caches can hold old values for the length of the record's TTL.

To cover every possible subdomain at once instead of creating them one by one, see how to create wildcard subdomains. For background on the records involved, read what is a DNS record.

FAQ

Does a subdomain cost extra?

Creating a subdomain does not require a separate domain registration. Your hosting or DNS provider can still charge for services or limit how many your plan allows.

Can a subdomain be on a different server?

Yes. Its DNS record can point to any server, which is why subdomains are used to run separate applications.

Is www a subdomain?

Yes. It is the most common one, and it only works if DNS has a record for it.

Sources

You can inspect public records with our DNS lookup before and after making changes.