What Is a Subdomain?
A subdomain is a prefix added before your main domain name, separated by a dot. In blog.example.com, "blog" is the subdomain. It creates a distinct section of your website with its own content, while still being part of the parent domain.
Common subdomain examples:
blog.example.com— company blogshop.example.com— e-commerce storeapp.example.com— web applicationdocs.example.com— documentationapi.example.com— API endpointsmail.example.com— email serverstaging.example.com— pre-production environment
Subdomains are free to create — you don't need to register anything new. If you own example.com, you can create unlimited subdomains through your DNS settings.
How Subdomains Work
Subdomains are configured through DNS records. When you create a subdomain, you're adding a new DNS entry that points to a specific server or IP address.
The DNS hierarchy:
.com ← TLD (top-level domain)
example.com ← domain (second-level)
blog.example.com ← subdomain (third-level)
us.blog.example.com ← sub-subdomain (fourth-level)
Each level is separated by a dot. Technically, www is also a subdomain — www.example.com is a subdomain of example.com. Most sites today redirect www to the bare domain or vice versa.
Setting up a subdomain:
- Log into your DNS provider or registrar dashboard
- Add an A record or CNAME record for the subdomain
- Point it to the IP address or hostname of the server hosting that content
- Wait for DNS propagation (usually minutes, sometimes up to 48 hours)
Subdomains vs. Subdirectories
One of the most common decisions in web architecture: should you use blog.example.com (subdomain) or example.com/blog (subdirectory)?
Subdirectories (paths):
| Aspect | Subdomain | Subdirectory |
|---|---|---|
| SEO authority | Treated as separate site | Inherits parent domain authority |
| Setup | Requires DNS configuration | Just create a folder/route |
| Hosting | Can use different servers | Same server as main site |
| Analytics | Separate tracking needed | Included in main analytics |
| SSL certificates | May need separate cert | Covered by parent cert |
When to use subdirectories:
Most of the time. Google's John Mueller has confirmed that subdirectories benefit from the parent domain's authority. For blogs, documentation, and most content sections, subdirectories are the simpler and more SEO-friendly choice.
When subdomains make sense:
- Different tech stacks: Your main site is Next.js but your docs use a static site generator
- Separate applications: A web app at
app.example.comthat's a completely different codebase - Multi-region sites:
uk.example.comfor UK-specific content - Third-party services:
support.example.compointing to Zendesk or similar - Development/staging:
staging.example.comfor pre-production testing
Subdomains and SEO
Google treats subdomains as mostly separate entities from the root domain. This has practical implications:
Authority inheritance:
Subdomains don't automatically inherit all the domain authority of the parent domain. Backlinks to blog.example.com primarily benefit the subdomain, not example.com. This is why most SEO professionals recommend subdirectories for content you want to rank.
Separate indexing:
Google may index and rank subdomains independently. A subdomain can rank for different keywords than the main domain, which can be beneficial for distinct product lines but problematic if you're trying to consolidate authority.
When subdomains help SEO:
- Targeting different countries with localized content
- Separating fundamentally different types of content (a SaaS tool vs. a blog)
- When the subdomain itself builds substantial authority
Common Subdomain Uses
www — The original subdomain:
The www subdomain was originally used to distinguish web servers from other services (mail, FTP). Today it's largely redundant. Most sites either redirect www to the bare domain or vice versa. Both approaches work fine.
mail and email subdomains:
Email infrastructure often uses subdomains for routing and authentication:
mail.example.com— mail server- MX records often point to subdomains
- SPF, DKIM, and DMARC records use subdomains for email authentication
api — API endpoints:
Many companies serve their API from a subdomain (api.stripe.com, api.github.com). This allows separate scaling, rate limiting, and infrastructure from the main website.
cdn — Content delivery:
Static assets (images, CSS, JavaScript) are sometimes served from a CDN subdomain like cdn.example.com or static.example.com to enable parallel downloads and separate caching.
Wildcard Subdomains
A wildcard DNS record (*.example.com) routes all subdomains to the same server. This enables:
- Multi-tenant SaaS: Each customer gets
customer-name.example.com - User profiles:
username.example.com(like Tumblr, WordPress.com) - Dynamic routing: Handle arbitrary subdomains in application code
Wildcard subdomains are configured with a * A record or CNAME record in DNS settings.
Subdomain Limits and Rules
Naming rules:
- Can contain letters (a-z), numbers (0-9), and hyphens (-)
- Cannot start or end with a hyphen
- Maximum 63 characters per subdomain label
- Total domain name (including all subdomains) cannot exceed 253 characters
- Case-insensitive:
Blog.Example.comandblog.example.comare the same
Practical limits:
There's no hard limit on how many subdomains you can create. DNS providers may impose their own limits, but technically you can have thousands of subdomains on a single domain.
Nesting subdomains:
You can create subdomains of subdomains: us.blog.example.com. Each level adds complexity to DNS management. Most sites don't go beyond two levels deep.
Choosing a Domain for Subdomains
If you're planning to use subdomains extensively, your root domain choice matters:
- Short root domains work best —
app.coreads better thanapp.mylongcompanyname.com - .com remains the most recognized root for subdomain-heavy sites
- ccTLDs like
.ioor.aiwork well for tech companies usingapi.company.iopatterns
Search for available domains if you're setting up a new project that will use subdomains.
Frequently Asked Questions
What is a subdomain?
A subdomain is a prefix added before a domain name, separated by a dot. In blog.example.com, "blog" is the subdomain. It creates a separate section of a website that can have its own content, design, and even hosting—while still being part of the parent domain.
What is a subdomain example?
Common examples include blog.example.com (blog), shop.example.com (online store), app.example.com (web application), docs.example.com (documentation), and api.example.com (API endpoints). www is technically also a subdomain.
Is www a subdomain?
Yes. www.example.com is technically a subdomain of example.com. It was originally used to distinguish web servers from other services. Today most sites redirect between www and non-www versions—both work the same way.
Are subdomains free?
Yes. If you own a domain name, you can create unlimited subdomains at no additional cost. You just add DNS records through your registrar or DNS provider's dashboard—no separate registration or payment required.
Is a subdomain better than a subdirectory for SEO?
Generally, subdirectories (example.com/blog) are better for SEO because they inherit the parent domain's authority. Google treats subdomains (blog.example.com) as mostly separate sites. Use subdomains when you need different hosting, tech stacks, or truly separate applications.
How many subdomains can I create?
There's no hard limit. DNS supports virtually unlimited subdomains per domain. Your DNS provider may impose practical limits, but most allow thousands. Each subdomain label can be up to 63 characters, and the total domain name cannot exceed 253 characters.
Can I have a subdomain of a subdomain?
Yes. You can nest subdomains: us.blog.example.com is a subdomain of blog.example.com. Each level adds a dot-separated label. Most sites don't go beyond two levels, as deeper nesting adds DNS complexity.