Adding a Cloudflare subdomain is one of the most common DNS tasks website owners run into — whether you’re launching a blog at blog.example.com, pointing app.example.com to your product, or setting up mail.example.com for email. The good news is that once you understand how Cloudflare’s DNS records work, creating a subdomain takes less than two minutes.
This guide walks through exactly how a subdomain record works inside Cloudflare, how to create one step by step, which record type to choose, and the mistakes that most commonly break subdomains after they’re added.
Table of Contents
What Is a Subdomain, Exactly?
A subdomain is a prefix placed in front of your main domain name to create a separate, addressable section of your website. If your root domain is example.com, then blog.example.com, shop.example.com, and app.example.com are all subdomains of it.
Each subdomain can:
- Point to a completely different server or IP address
- Run entirely different software than your main site
- Be managed as its own project while staying under the same brand
If you want the full breakdown of the concept before diving into setup, our guide on what is a subdomain covers it from the ground up, and domain vs subdomain explains how the two relate structurally.
What Cloudflare Actually Does for Your Subdomain
Cloudflare doesn’t host your website — it manages the DNS (Domain Name System) for your domain, which is the system that translates human-readable names like blog.example.com into the IP address of the server that actually hosts the content.
When you “add a subdomain in Cloudflare,” what you’re really doing is creating a new DNS record that tells the internet where blog.example.com (or whichever subdomain you’re setting up) should point. Cloudflare doesn’t automatically know about subdomains — you have to explicitly create a record for each one, the same way you’d create one with any DNS provider.
DNS Record Types Used for a Subdomain
Before creating a record, it helps to know which type you actually need.
| Record Type | What It Does | When to Use It |
| A Record | Points a subdomain directly to an IPv4 address | You know the exact server IP hosting the subdomain |
| AAAA Record | Points a subdomain to an IPv6 address | Same as above, but for IPv6 |
| CNAME Record | Points a subdomain to another hostname instead of an IP | The subdomain should follow another domain (e.g., a hosting platform’s default URL) |
A subdomain A record is the most common choice when you’re pointing directly to a VPS or dedicated server IP. A CNAME is more common when you’re using a third-party platform (like a website builder or app host) that gives you a hostname to point to instead of a fixed IP.
How to Add a Subdomain in Cloudflare (Step by Step)
Here’s the exact process for creating a Cloudflare subdomain using an A record or CNAME record.
Step 1: Log in to your Cloudflare dashboard Go to the Cloudflare dashboard and select the domain (zone) you want to add the subdomain to.
Step 2: Open the DNS section From the domain’s dashboard, click DNS, then Records. This is where every DNS record for your domain — including all its subdomains — lives.
Step 3: Click “Add record” This opens a form where you’ll define the new subdomain.
Step 4: Choose the record type Select A if you’re pointing to an IP address, or CNAME if you’re pointing to another hostname.
Step 5: Enter the subdomain name In the Name field, enter only the subdomain part — not the full hostname. For example, to create blog.example.com, type blog, not blog.example.com. Cloudflare automatically appends your root domain.
Step 6: Enter the target
- For an A record: enter the IP address of the server hosting the subdomain.
- For a CNAME record: enter the target hostname it should point to.
Step 7: Set the proxy status Cloudflare gives you two options, shown as a toggle:
- Proxied (orange cloud): Traffic routes through Cloudflare, giving you their CDN, DDoS protection, and hidden origin IP.
- DNS only (gray cloud): Traffic goes directly to your server with none of Cloudflare’s proxy features — just DNS resolution.
Most websites should use Proxied for the performance and security benefits. Use DNS only for services like email or anything that requires a direct, unproxied connection (Cloudflare’s proxy only works for standard web traffic on supported ports).
Step 8: Save the record Click Save. The subdomain typically becomes active within minutes, though full DNS propagation can occasionally take longer.
Step 9: Point your server to accept the subdomain Creating the DNS record only handles the address lookup — your web server also needs to be configured to respond to that specific hostname. For example, on an Nginx server this means adding a server_name block matching the subdomain, then reloading the server.
Real-World Example
Say you’re launching a documentation site at docs.example.com, hosted on a separate server with the IP 203.0.113.25.
- In Cloudflare, go to DNS → Records → Add record
- Type: A
- Name: docs
- IPv4 address: 203.0.113.25
- Proxy status: Proxied
- Save
Within minutes, docs.example.com resolves through Cloudflare and routes to your documentation server.
If instead you were hosting on a platform that gives you a target hostname (a common setup for many hosting and app platforms), you’d choose CNAME instead of A, and paste that hostname into the target field rather than an IP.
Common Mistakes When Adding a Subdomain in Cloudflare
- Typing the full hostname in the Name field. Entering blog.example.com instead of just blog often creates an incorrect record like blog.example.com.example.com.
- Using the wrong record type. Pointing an A record at a hostname (instead of an IP) or a CNAME at an IP address will fail — each type expects a specific kind of value.
- Leaving proxy status on when it shouldn’t be. Certain services (particularly email and some non-standard ports) require DNS only mode; leaving proxy on can break them.
- Forgetting server-side configuration. The DNS record makes the subdomain resolve, but your web server still needs to be told to serve content for that specific hostname — otherwise visitors hit a default page or an error.
- Assuming instant propagation everywhere. Most Cloudflare changes are fast, but some resolvers cache old DNS results temporarily, so a subdomain may take a little time to resolve for every visitor.
Best Practices for Managing Subdomains in Cloudflare
- Keep a running list of every subdomain and what it points to — forgotten subdomains are a common source of confusion and even security risk later on.
- Use Proxied mode by default for anything that serves regular web traffic, to take advantage of Cloudflare’s caching and protection.
- Set a sensible TTL (Time to Live) — Cloudflare’s “Auto” setting works well for most cases and adjusts automatically when the record is proxied.
- Secure every subdomain with HTTPS. A record existing in DNS doesn’t mean it’s encrypted — each subdomain still needs valid coverage, which our guide to SSL subdomain setups explains in detail.
- If you’re managing dozens of subdomains, consider a wildcard DNS record (*) instead of creating one record per subdomain individually, provided they all point to the same target.
Cloudflare Subdomain vs. Subdomain on Other DNS Providers
The concept of a subdomain record is identical no matter which DNS provider you use — Cloudflare, GoDaddy, Namecheap, or anywhere else. What differs is the interface and the extra features layered on top. Cloudflare’s main advantages are its free proxy/CDN layer, fast propagation, and built-in security tools, which most traditional registrar DNS panels don’t offer at no cost.
If you’re still deciding how to structure your site’s sections, it’s worth understanding the difference between a subdomain vs subdirectory approach, since the choice affects both DNS setup and SEO — a topic covered in more depth in our guide to subdomain SEO.
Frequently Asked Questions
Can I add a subdomain in Cloudflare for free? Yes. Adding DNS records, including subdomains, is included on Cloudflare’s free plan with no limit tied specifically to the number of subdomain records for a standard use case.
What’s the difference between an A record and a CNAME for a subdomain? An A record points a subdomain directly to an IP address. A CNAME record points a subdomain to another hostname, which is then resolved separately. Use an A record when you have a fixed IP; use a CNAME when a service gives you a hostname to point to instead.
Why is my Cloudflare subdomain not working after I added it? The most common causes are entering the full hostname instead of just the subdomain in the Name field, using the wrong record type for the target value, or the destination server not being configured to respond to that hostname.
Should a subdomain be proxied or DNS only in Cloudflare? Proxied is best for standard websites, since it enables Cloudflare’s CDN and security features. DNS only should be used for services that require a direct connection, such as certain email or non-HTTP(S) services.
Does adding a subdomain in Cloudflare automatically create SSL for it? If the subdomain is proxied and your domain uses Cloudflare’s SSL/TLS settings, Cloudflare can issue a certificate covering it. If the subdomain is DNS only or hosted elsewhere, you’ll need to set up a certificate separately — see our SSL subdomain guide for the details.
How long does it take for a new Cloudflare subdomain to work? Usually just a few minutes. Full global propagation can occasionally take longer due to DNS caching on some networks, but most visitors will see it resolve almost immediately.
Final Thoughts
Creating a subdomain in Cloudflare comes down to one core action: adding a DNS record — either an A record or a CNAME — with the correct subdomain name and target. The interface makes it fast, but the details matter: the right record type, the right name field format, and the right proxy setting are what separate a subdomain that works instantly from one that causes hours of troubleshooting.
Once your subdomain is live, it’s worth revisiting the basics of how a URL is structured and how a fully qualified domain name fits together, especially if you’re managing several subdomains across a growing site.
