To set up Cloudflare DNS for a website, you add your domain in the Cloudflare dashboard, check that every existing DNS record was copied over, and then replace your registrar's nameservers with the two Cloudflare assigns to you. Once Cloudflare sees the change, the domain goes active. The work that matters happens before you switch: a complete record list, DNSSEC handled, and the right proxy setting on each record.
This guide walks through the whole process in order, explains the orange cloud and grey cloud choice, shows how to test the result, and covers custom (vanity) nameservers and glue records for people who need them.
TL;DR
- Add the domain in Cloudflare, then review the imported records by hand. The automatic scan can miss some, especially email and subdomain records.
- Turn off DNSSEC at your registrar before changing nameservers, and re-enable it afterward if you use it.
- Proxy (orange cloud) web hostnames such as the root domain and www. Keep mail, SSH, FTP and database hostnames on DNS only (grey cloud).
- Test with a lookup tool and a browser after the switch, and keep your old host live until propagation finishes.
- Custom nameservers need glue records created at the registrar, not just records inside your DNS zone.
Table of Contents
- What you are actually setting up
- Before you start: what to have ready
- Step 1: Add your domain to Cloudflare
- Step 2: Check every DNS record before you switch
- Step 3: Choose proxied or DNS only for each record
- Step 4: Handle DNSSEC before changing nameservers
- Step 5: Change your nameservers at the registrar
- Step 6: Test that the setup works
- Custom nameservers and glue records
- Perspective
- Where a reliable origin fits in
- FAQ
- Sources
What you are actually setting up
Two things get called "Cloudflare DNS setup", and they are not the same job.
The first is using Cloudflare's public resolver, 1.1.1.1, on a laptop, phone, router or game console. That changes how your devices look up other people's websites. It has nothing to do with your own domain.
The second, which this article covers, is hosting your domain's DNS zone at Cloudflare. That changes how everyone else finds your website, email and other services. You do it once per domain, and it involves your registrar (where you bought the domain) and your web host (where the site files live).
If you are unsure how those three roles fit together, our explainer on DNS management for website owners lays out who controls what.
Before you start: what to have ready
Gather these so you are not hunting for logins mid-change:
- Registrar login for the domain, with access to nameserver and DNSSEC settings.
- The IP address or hostname of your web server, from your hosting control panel.
- A list of every service that uses the domain: website, email provider, verification records, subdomains for apps or staging, and anything else.
- A free Cloudflare account.
The list of services is the item people skip, and it causes most of the trouble later. Open your current DNS zone at your host or registrar and copy the records into a note or take a screenshot. Pay particular attention to MX records (email), TXT records (SPF, DKIM, domain verification) and any subdomains.
Step 1: Add your domain to Cloudflare
- Sign in to the Cloudflare dashboard and choose the option to add a domain.
- Enter your root domain, for example
example.com, without www or https. - Pick a plan. A free plan is enough for DNS and basic proxying on most small sites.
- Let Cloudflare run its quick scan of your existing DNS records.
The scan is a convenience, not a guarantee. Cloudflare's documentation warns that the quick scan is not guaranteed to find every existing record, so you should review the results, especially zone apex, subdomain and email records.
Step 2: Check every DNS record before you switch
Compare Cloudflare's imported list against the list you saved. Look for:
- A and AAAA records for the root domain and
www, pointing to your server's IPv4 and IPv6 addresses. - CNAME records for subdomains that point to another hostname.
- MX records for email, with the same priorities as before.
- TXT records for SPF, DKIM, DMARC and service verification.
- Any record for a subdomain you forgot about, such as
shop,staging,mailorcpanel.
This step is not optional. According to the same Cloudflare documentation, activating a domain without the right records can leave visitors seeing DNS_PROBE_FINISHED_NXDOMAIN errors. That error means the name does not resolve at all, and your visitors see it before they ever reach your site.
If you are unsure whether a subdomain should be an A record or a CNAME, our guide to A record vs CNAME explains the difference and when each fits.
Step 3: Choose proxied or DNS only for each record
Every A, AAAA and CNAME record in Cloudflare has a cloud icon. Orange means proxied: visitors connect to Cloudflare, which forwards the request to your server. Grey means DNS only: Cloudflare answers the lookup with your real server address and stays out of the way.
The working rule is simple. Web traffic gets the orange cloud; non-HTTP traffic such as mail, SSH, FTP and databases stays grey, and only A, AAAA and CNAME records can be proxied at all. Getting one hostname wrong can cut off a protocol or reveal the address of your origin server.
| Record or hostname | Typical setting | Why |
|---|---|---|
Root domain (example.com) pointing to your site | Proxied | Gets Cloudflare's DDoS protection, caching and firewall in front of web traffic |
www pointing to your site | Proxied | Same reason as the root domain |
mail, smtp, imap hostnames | DNS only | Mail is not HTTP traffic and must reach the mail server directly |
ftp, ssh, database hosts | DNS only | Not web traffic, so a proxy would break the connection |
| MX, TXT, NS, SRV records | DNS only (always) | These record types cannot be proxied |
| Hostnames a verification system must reach directly | DNS only | A proxy can hide the origin the service is trying to check |
The details of this table follow the proxied versus DNS only guidance, which also notes that Cloudflare proxies HTTP and HTTPS on supported ports only.
A common mistake: proxying the mail hostname
Suppose your MX record points to mail.example.com, and mail.example.com is an A record. If that A record is orange, mail servers trying to deliver to you hit Cloudflare's web proxy, which does not speak SMTP. Messages bounce or stall. Set it to grey and mail flows again. The MX record itself is always DNS only, but the hostname it points to is a separate record that needs your attention.

Does the orange cloud affect SSL?
Yes, it changes where encryption terminates, so confirm your origin server has a valid certificate before you switch on proxying for the main hostnames. Our walkthrough on setting up SSL for a small business site covers certificate basics. Every inSave Hosting plan includes a free SSL certificate, which gives your origin a valid certificate to start from.
Step 4: Handle DNSSEC before changing nameservers
If DNSSEC is enabled for your domain at the registrar, it can break resolution when the nameservers change, because the old signing keys no longer match the new zone. Cloudflare's guidance is to disable DNSSEC at your registrar before changing nameservers to avoid connectivity errors, and to confirm it is off at that point.
Once your domain is active on Cloudflare, you can turn DNSSEC back on from the Cloudflare dashboard and add the resulting DS record at your registrar. If you want background on what DNSSEC protects, read what DNSSEC is and why it matters.
Step 5: Change your nameservers at the registrar
Cloudflare shows you two nameservers assigned to your account, usually a pair of names ending in ns.cloudflare.com. Use the exact pair shown for your domain, because they differ from account to account.
- Log in to your registrar and open the domain's nameserver settings.
- Remove the existing nameservers.
- Enter the two Cloudflare nameservers.
- Save, then return to Cloudflare and select the option to check nameservers.
Cloudflare will email you when the domain is active. This can take from a few minutes to a day or more, depending on how quickly the change spreads through the global DNS system.
If your domain is registered with us, the nameserver setting lives in the domain management area, and domain registration with DNS management is included. For a deeper look at timing and how to avoid a gap in service, see our guide on changing nameservers without downtime. It explains why the old and new setups should both be correct during the switch.
Which is the better option: nameserver change or A record change?
Changing nameservers moves control of the entire DNS zone to Cloudflare. Changing only an A record points one hostname at a new server and leaves everything else where it is. For Cloudflare's proxy and DNS features you need the nameserver route. Nameserver vs A record breaks down when each is the right tool.
Step 6: Test that the setup works
Do not rely on one browser tab. Check in layers.
- Dashboard status. The domain should show as active in Cloudflare. If it still says pending, the registrar change has not been picked up yet, or the wrong nameservers were entered.
- Nameserver lookup. Run
dig NS example.com +shorton Mac or Linux, ornslookup -type=NS example.comon Windows. The answer should list the two Cloudflare nameservers. If you still see the old ones, wait and recheck. - Record lookup. Run
dig example.com A +short. For a proxied record you will see Cloudflare addresses rather than your server's address. That is expected. For a grey cloud record you will see your actual server address. - Browser test. Open the site in a private window, both the root domain and
www. - Email test. Send a message to and from an address on the domain, and check that MX and TXT records are intact.
If something fails
| Symptom | Likely cause | Fix |
|---|---|---|
| Name does not resolve (NXDOMAIN) | A needed record was missing when you switched | Add the record in Cloudflare, matching your saved list |
| Domain stays pending | Old nameservers still set, or a typo | Re-enter the exact pair Cloudflare shows and save |
| Site works on some networks only | Propagation still in progress | Wait, and keep the old host online meanwhile |
| Resolution errors right after the switch | DNSSEC still active at registrar | Remove the DS record at the registrar, then recheck |
| Email bounces | Mail hostname set to proxied, or MX or TXT missing | Set the mail hostname to DNS only and restore the missing records |
| Site loads but shows the wrong content | A record points to the wrong server | Correct the IP in Cloudflare |
When in doubt, compare the live records against the list you saved before the change. Nine times out of ten the fix is a record that is missing or has the wrong cloud setting.
Custom nameservers and glue records
By default your domain uses the Cloudflare-assigned nameservers. Custom nameservers, also called vanity or branded nameservers, are nameservers that carry your own domain, for example ns1.yourbrand.com and ns2.yourbrand.com. Agencies and resellers use them so clients see the agency's name instead of the DNS provider's.
You need them when:
- You resell hosting or manage DNS for many clients and want a consistent brand.
- A client's contract or policy asks for nameservers under your own domain.
Most single-site owners do not need them. Standard nameservers are simpler and have fewer moving parts.
How custom nameservers work
The setup has three parts:
- Decide the hostnames, for example
ns1.yourbrand.comandns2.yourbrand.com. - Have your DNS provider give you the IP addresses those names must resolve to. Your provider's documentation or support will tell you which addresses apply to your account and plan.
- Create glue records at the registrar of the domain that hosts the nameservers, then set the nameservers on the client domains to those names.
What a glue record is and where you add it
There is a loop built into branded nameservers: to find ns1.yourbrand.com a resolver must ask the nameservers of yourbrand.com, which are ns1.yourbrand.com. A glue record breaks the loop by storing the nameserver's IP address at the parent level, in the registry for the top-level domain (.com, for example).
You create glue records at the registrar, in the section usually called "host records", "child nameservers" or "register nameserver". Adding an A record inside your DNS zone is not the same thing and does not work as glue. Enter the hostname and the IP address it should resolve to, for each nameserver, then save.
A few practical points:
- Create glue records only for nameservers that sit under the domain you registered, not for names under someone else's domain.
- Make sure the same names and addresses also exist as records in the DNS zone, so answers stay consistent.
- After creating glue, set the domain's nameservers to the custom names, and run the
dig NStest from Step 6. - If your registrar does not offer host records, ask its support, or use a registrar that does.
A domain registered with our domain registration service comes with DNS management, so you can manage those settings from one place. Check the details for custom nameserver options with our support before you plan a reseller rollout.
Perspective
Most DNS outages we see after a move are not Cloudflare problems or host problems. They are inventory problems: a record nobody wrote down, an email hostname set to the wrong cloud, or DNSSEC left on at the registrar.
Our approach is to treat the DNS switch as a small migration. We list every record first, move the site and email together, and keep the previous setup running until the new one is verified. Our SRE and DevOps engineers in the EU and US work this way on free migrations, and it is the same checklist we recommend you follow on your own.
Cloudflare's DNS and proxy pair well with a host that has a clean origin: a valid SSL certificate, daily backups and fast PHP, LiteSpeed-based serving. You get a fast edge and a reliable server behind it, which is the combination that holds up on busy days.
Ihor
Where a reliable origin fits in
Cloudflare handles DNS and sits in front of your site, but the site itself still lives on a server. We built inSave Hosting for small and mid-sized businesses, bloggers and agencies who want that server side handled: free SSL, daily backups, free migration and a 30-day money-back guarantee, backed by engineers in the EU and US.

If you run WordPress, our WordPress hosting plans include one-click install and management tools. For simpler sites, see shared hosting. If you need dedicated resources, our VPS plans give you root access and room to grow. Not sure which fits? Start at inSave Hosting and our team can help you match a plan to your site.
FAQ
Do I need to move my website to use Cloudflare DNS?
No. Changing nameservers only changes who answers DNS lookups. Your site files stay on the same host, and you point the A record in Cloudflare at that host's IP address. The one thing to double-check is that the record exists before you switch.
Should I set Cloudflare records to proxied or DNS only?
Proxy web hostnames like the root domain and www, and keep mail, SSH, FTP and database hostnames on DNS only. Only A, AAAA and CNAME records can be proxied, and MX, TXT, NS and SRV records are always DNS only. If a service does not use HTTP or HTTPS, leave it grey.
How long does a nameserver change take?
It varies. Cloudflare emails you when the domain is active, and some networks see the change before others. Keep your previous setup running and all records correct on both sides until every test passes.
Do I need glue records for Cloudflare nameservers?
No. Glue records are for custom nameservers that sit under your own domain, such as ns1.yourbrand.com. If you use the standard nameservers Cloudflare assigns, you only enter those two names at your registrar.
Is changing 1.1.1.1 on my computer the same as this?
No. Setting 1.1.1.1 on a device changes the resolver that device uses to look up other sites. Setting up Cloudflare DNS for your domain changes where your own domain's records are hosted for everyone.
Sources
- Cloudflare documentation: add a site
- Proxied or DNS only in Cloudflare: how to decide for every record
- Cloudflare Proxied vs DNS Only: The Orange and Grey Cloud
