Subdomains are one of the most useful tools in a developer's toolkit. Here's everything you need to know, in plain English.
If you've spent any time on the web, you've used subdomains without even realising it. mail.google.com, docs.github.com, app.notion.so — these are all subdomains. Understanding how they work and when to use them is one of the most practical DNS skills you can develop.
A subdomain is an extension that goes in front of your main domain name, separated by a dot. If your domain is example.com, then anything.example.com is a subdomain — where "anything" is the subdomain label.
From a DNS perspective, a subdomain is simply a hostname at a lower level in the DNS hierarchy. You create it by adding a DNS record (usually an A or CNAME record) with the subdomain name in the Name/Host field.
www.example.com → Traditional website prefix blog.example.com → Blog or content section app.example.com → Web application api.example.com → API endpoint staging.example.com → Pre-production environment docs.example.com → Documentation
Subdomains let you organise your web presence in ways that are both technically useful and user-friendly:
api.yourdomain.com can run Node.js while yourdomain.com runs a static sitestaging.yourdomain.com for testing, yourdomain.com for productionyourdomain.com/app when the "app" is actually a separate serviceA question that comes up a lot: should your blog live at blog.yourdomain.com or yourdomain.com/blog? Both work, and the right answer depends on your setup.
Use a subdomain when the service is truly separate — different technology, different server, deployed independently. Use a subdirectory when it's part of the same application and you want to keep SEO authority consolidated.
If you don't have your own domain yet, you can get a free, professional subdomain through Open Domains. Subdomains like myproject.is-a.dev are hosted on Cloudflare's DNS network, reviewed by a real person, and completely free.