Websites & hosting · Term

Subdomain

A subdomain is a named section in front of a domain, such as shop.example.com or blog.example.com, that can point to a separate website, server or service while sharing the main domain name.

A subdomain is not a subfolder. The address example.com/blog is a folder inside one website; blog.example.com can be a completely separate site on a different host, with its own software, settings and logins. Even www is technically a subdomain. Subdomains cost nothing extra because you already hold the domain; you create as many as you need by adding DNS records.

A wildcard certificate for *.example.com covers shop.example.com and book.example.com, but only one level: it does not cover a.shop.example.com, and on its own it does not cover the bare example.com either. Most certificate tools handle this automatically, but it explains why a deeper subdomain sometimes shows a warning when the others do not.

How it works

You create a subdomain by adding a DNS record for it, usually an A record pointing to a server's address or a CNAME pointing to another name. Changes to one subdomain's records do not affect the main site or the other subdomains. A booking platform, for example, might ask you to create book.example.com as a CNAME pointing to its own servers, so customers see your name while the platform runs the tool.

Each subdomain needs to be covered by an SSL/TLS certificate, either its own or a wildcard certificate covering every subdomain, or browsers will show a security warning.

Each subdomain can have its own records, including its own email (MX) records. The risk to know about is the dangling record. If a subdomain still points by CNAME to a third-party service you have cancelled, someone else may be able to sign up on that service and claim the name, serving their content under your domain. This is called subdomain takeover, and it is prevented simply by deleting DNS records for services you no longer use.

Example

A travel agency runs its main site on example.com and connects its online booking system at book.example.com, where the booking provider hosts it. It also keeps a staging copy of the main site at staging.example.com, protected by a password and blocked from search engines, so changes can be tested before going live.

Once a year the agency's owner opens the DNS zone, lists every subdomain and checks that each one still points to a service the business actively uses. An old landing page tool, cancelled two years earlier, still has a CNAME; the record is deleted on the spot. The owner also checks that staging.example.com asks for a password, and that a search for site:staging.example.com in Google returns nothing, a quick sign that the test copy is not indexed.

Why it matters for your business

Subdomains let you plug in outside tools under your own brand without moving your main site, and they keep test copies away from the public site. The trade-off is fragmentation: content spread across several subdomains is several things to maintain and measure, and analytics need extra setup to follow visitors across them. Google has said it can handle both subdomains and subfolders, but a blog in a subfolder is simpler to run as part of one site. When a tool only works on a subdomain, that is fine; add it to the list of things to review whenever you change providers or rebrand.

Common mistakes

  • Putting the blog on a separate subdomain and platform without a reason, then maintaining two sites.
  • Leaving old subdomains pointing at services you have cancelled, which an attacker may be able to claim.
  • Letting a staging subdomain be indexed by Google alongside the real site.
  • Forgetting the certificate, so the subdomain shows a security warning.

Questions people ask

Is a subdomain bad for SEO?

Not inherently. Google can crawl and rank pages on subdomains. The practical difference is that a subdomain is often managed and measured as a separate site, while a subfolder grows the main site directly. For a blog or service pages, a subfolder is usually simpler unless there is a technical reason to separate them.

Do I have to pay for a subdomain?

No. Once you hold a domain, you can create subdomains by adding DNS records at no extra cost from the registrar. You may still pay for whatever the subdomain points to, such as separate hosting or a third-party tool.

Is www a subdomain?

Technically yes. The www in www.example.com is a subdomain of example.com. Most sites choose one version, with or without www, and redirect the other to it so search engines and visitors always see a single address.

Related terms

Have something worth building right?