What is a subdomain?
A subdomain is an extra name in front of a domain, such as shop.example.com or blog.example.com: it points to its own place, which can be a different server, and you add it with a DNS record. For search engines, the difference that matters is that several rules follow the hostname, not the site. robots.txt, the favicon and the site name in Google results all belong to a hostname, not to the site as a whole, so a subdomain needs its own. On one of the 4 sites I run, a small service on a subdomain serves a robots.txt with no rules at all, while the main site's file has 4 Disallow lines.
The parts of a hostname
You register example.com once. Every name in front of it, such as www, shop, blog or help, is a subdomain you create yourself, usually with a DNS record that points it at a server or a hosting service. www is a subdomain too, and most sites send it to the bare domain or the other way round. The www vs non-www study measured what sites actually do with it.
How a subdomain is set up
You create a subdomain in your domain's DNS, the system that turns names into server addresses. Two records do most of the work:
- An A record points the name at a server's IP address.
- A CNAME record points the name at another domain name, never at an IP address. Subdomains such as blog.example.com or shop.example.com often use one, pointed at the service that hosts them.
On 10 November 2026 I looked up the www name of each of the 4 sites. 1 of them points at its host with a CNAME. The other 3 sit behind a proxy, so public DNS shows only the proxy's two addresses. The service on a subdomain resolves to exactly the same two addresses as its main site, and still serves a different robots.txt: the proxy reads the hostname and hands the request to a different program. Two names on one address can be two different sites.
Subdomain or subfolder?
shop.example.com is a subdomain. example.com/shop/ is a subfolder, also called a subdirectory. Google's guide to sites in several countries compares the two:
| Subdomain | Subfolder | |
|---|---|---|
| Setting up | Easy | Easy |
| Where it runs | Can be a different server | Same host as the main site |
| Keeping it separate | Easy | Harder |
From Google Search Central, read 10 November 2026. Google also lists low maintenance as a plus of the subfolder, because it's the same host.
Google's documentation doesn't say one ranks better than the other. What it does document is a set of rules that follow the hostname, and those decide most of the practical difference.
What a subdomain gets on its own
| Rule | Per hostname? | What it means for a subdomain |
|---|---|---|
| robots.txt | Yes | The main site's file doesn't apply. The subdomain needs its own at /robots.txt |
| Favicon in Google | Yes | Google supports one favicon per hostname, so the subdomain can have its own, and needs one |
| Site name in Google | Yes | One site name per domain or subdomain. A subfolder can't have its own |
| Search Console | Depends on the property | A Domain property covers every subdomain. A URL-prefix property covers only the one you enter |
| HSTS | Can cover all | A header with includeSubDomains applies HTTPS to every subdomain |
Read on each Google page and the robots.txt standard, 10 November 2026.
Two of those catch people out. A subdomain launched on a different service can end up with a robots.txt the service supplies, not yours. And a Search Console URL-prefix property for https://example.com shows nothing about shop.example.com, so a problem there can sit unseen.
What I found on my own sites
On 10 November 2026 I checked 4 sites I run.
| Result | |
|---|---|
| www. subdomain | All 4 send www. to the bare domain with a 301, robots.txt included |
| That subdomain's robots.txt | Its own file: 24 lines, all comments, no rules |
| The main site's robots.txt | 4 Disallow lines that don't reach the subdomain |
| That subdomain's favicon | None: /favicon.ico returns 404 |
The subdomain runs a small tool that answers requests from apps, not a page for people, so an empty robots.txt and no favicon do no harm there. But it shows the rule: nothing you set on the main site carried over. If that subdomain had been a blog, its pages would have been open to every crawler, and Google would have had no favicon to show for it, whatever the main site said.
Cookies follow the domain you name
Logins and other cookies have their own subdomain rule. A cookie set without a Domain attribute stays on the host that set it and doesn't reach its subdomains. A cookie set with Domain=example.com goes to example.com and every subdomain under it. A server can widen a cookie to its own parent domain, but never point it at a subdomain or another domain.
That is how one login can work on example.com and shop.example.com. It's also why handing a subdomain to an outside service deserves a second look: any cookie scoped to the whole domain reaches that service too. None of the 4 home pages I checked sets a cookie with a Domain attribute.
Subdomains and spam
Google's spam policies name subdomains in one place: using existing or new subdomains, subfolders or sites to keep breaking its policies is itself a violation.
What Check Engine checks
Check Engine treats a link to one of your own subdomains as your own link, not an outbound one. When such a link is broken, it says so under its own title instead of mixing it into the count of broken links to other sites. It also reads the HSTS preload list, so a domain ending that is preloaded with its subdomains included is not flagged for a missing header. The robots.txt guide covers the per-host rule in more detail.
Sources
- Google, managing multi-regional and multilingual sites
- Google Search Console Help, add a website property
- Google, site names
- Google, favicon in search results
- Google, spam policies
- RFC 9309, robots exclusion protocol
- MDN, using HTTP cookies
- Cloudflare Learning, what is a DNS CNAME record
$59once
For Macs with Apple silicon or Intel, macOS 12 or later, and 64-bit Windows
Priced in US dollars. Checkout shows your currency and any local tax.
On a Mac? Get the Mac version.
On your phone?
Launch price: $29.50 once, through 30 November. From 1 December: $59. Buy applies the code FOUNDINGDOCKET for you; if the checkout shows $59, enter it under ‘Have a discount code?’.
Screaming Frog is $279 a year. Ahrefs plans with Site Audit run $129–$449 a month. Check Engine is $59 once. Screaming Frog’s price read 4 November 2026, Ahrefs’ 9 November 2026.
30 days, no conditions, no questions asked. Refund policy
Common questions
What is an example of a subdomain?
In blog.example.com, blog is the subdomain, example is the domain and .com is the top-level domain. www.example.com is a subdomain too.
Is a subdomain a separate website to Google?
For several rules, yes. robots.txt, the favicon and the site name in Google results are set per hostname. A Search Console Domain property groups all of a domain's subdomains together.
Is a subdomain or a subfolder better for SEO?
Google's documentation doesn't rank one above the other. A subfolder shares the main site's host and settings, while a subdomain needs its own robots.txt and favicon and can run on a different server.
How do I create a subdomain?
Add a DNS record for the new name wherever your domain's DNS is managed: an A record that points to a server's IP address, or a CNAME that points to another domain name, often the hosting service's. Then set up the site on that server for the new name.
Do I need a robots.txt on a subdomain?
If you want rules there, yes. A robots.txt applies only to its own host, so the main site's file does nothing for a subdomain.