A subdomain is a domain that sits inside another domain: blog.example.com and shop.example.com are subdomains of example.com, and so, technically, is the familiar www. You don't register a subdomain; you create it with a record in your domain's DNS, so it costs nothing once you own the domain.
You can create as many as you need, and each one can point to a different server, run different software and act as its own website.
How a subdomain fits into a domain name
Domain names are read from right to left. In shop.example.com, com is the top-level domain, example is the name you registered, and shop is the subdomain. The Domain Name System defines a subdomain simply as a domain contained within another, so eu.shop.example.com is a subdomain of both shop.example.com and example.com. Each part between dots can be up to 63 characters. RFC 1034
To create one, add a DNS record wherever your domain's DNS is managed:
- an A record (or AAAA for IPv6) points the subdomain to a server's IP address;
- a CNAME record points it to another hostname, which is how you connect a hosted shop, help desk or landing page tool.
The subdomain also needs its own HTTPS certificate, or one that covers it.
What subdomains are used for
- Separate platforms. The main site runs on one system, while
shop.,help.orapp.run on software built for that job. - Regional or language versions, such as
de.example.comfor Germany. - Testing. A
staging.copy of the site for checking changes before they go live. Protect it with a password so it never shows up in search.
Subdomain or subfolder?
This is the question most site owners actually have: should the blog live at blog.example.com or at example.com/blog/?
Google's answer is to do what makes sense for your business. Its SEO starter guide says a site may be easier to manage in subdirectories, while other times it makes sense to split topics into subdomains. Google Search Central
You'll still read that subdomains "don't share authority" with the main site. Google doesn't say that. Links to a subdomain are still links, and you can link the two parts to each other like any other pages. The practical differences matter more. Google's guide to international SEO sums them up for regional sites, and the same points apply elsewhere:
Subdomain (blog.example.com) |
Subfolder (example.com/blog/) |
|
|---|---|---|
| Setup | Easy: one DNS record | Easy: a folder on the same site |
| Hosting | Can run on a different server or platform | Same server and usually the same CMS |
| Maintenance | Another site to look after | Low: one site |
| Separation | Easy to keep apart | Harder to separate later |
A simple rule: if the content can live in your main CMS, a subfolder is usually less work. If it needs a different platform, a subdomain is the natural fit.
What changes when content is on a subdomain
Search engines treat each hostname as its own address in a few concrete ways:
- robots.txt is per subdomain. The file at
example.com/robots.txtdoesn't apply toblog.example.com; each subdomain needs its own robots.txt. - Search Console needs the right property. A Domain property in Google Search Console covers every subdomain and protocol and is verified through DNS. A URL-prefix property such as
https://example.comleaves other subdomains out. You can still filter a Domain property by subdomain in the Performance report. - Each subdomain can have its own favicon. Google shows one favicon per hostname, so
news.example.comcan have its own icon in search results, butexample.com/news/can't. - Moves include every variant. When you move a site to a new domain, Google's site move guide says to cover all subdomain variants, including both www and non-www.
Pick one version of your main hostname, with or without www, and redirect the other to it. Serving the same pages on both creates duplicate content for no benefit.