Skip to content
AE DIGITAL
Server & DomainsBy 6 min read

Move DNS to Cloudflare without losing email or your website: a safe procedure

How to move DNS to Cloudflare without breaking mail or the website: record inventory, checking the import, orange or grey cloud, the nameserver switch and a rollback plan.

Article cover: the word “DNS” next to a glowing icon on a violet space background

What changes when you move DNS to Cloudflare

Moving your DNS to Cloudflare means that, from then on, Cloudflare's nameservers answer the question "where does this domain live?". The domain stays registered with your current registrar, hosting stays where it is, and mail keeps flowing through Google Workspace, Microsoft 365 or whichever provider you use. Only the keeper of the DNS zone changes.

The benefits are tangible: fast DNS managed from a clear dashboard, a proxy with caching and protection for the website, managed certificates, all available on the free plan. There is one risk, and it is a serious one: after the switch, Cloudflare answers only with the records in its zone. A forgotten record stops existing for the rest of the internet. The first casualty is almost always a mail-related record, which is why "emails stopped arriving after moving to Cloudflare" is the most common problem.

Inventory of your existing records

Before creating the zone in Cloudflare, write down the full list of current records. If your provider allows it, export the zone file in BIND format: it is the most reliable source. Otherwise copy the records from the panel and screenshot every page.

Records to look for

  • Website: A or AAAA for the root domain, a record for www.
  • Mail: every MX with its priority, the SPF TXT record, DKIM records, _dmarc, any autodiscover CNAME and the SRV records for Microsoft 365.
  • Verifications: TXT records for Google Search Console, Meta, Microsoft and email marketing platforms.
  • Subdomains: shop, app, staging, webmail, cpanel, ftp and anything the team uses without remembering it exists.

The DKIM problem

DKIM records live under a name that contains a selector, for example google._domainkey for Google Workspace or selector1._domainkey for Microsoft 365. An automatic scan cannot guess selectors it does not know. Check your mail provider's admin panel and every service that sends email on your behalf (newsletter tool, ERP, CRM) for the selectors they use. For the bigger picture on how domain, DNS and mail fit together, see our technical guide to DNS, domains and hosting.

Automatic import: what to check

When you add the domain, Cloudflare runs a quick scan and imports the records it finds. The documentation is clear that the scan is not guaranteed to find every record and must be reviewed. Alternatively, you can upload the exported BIND zone file.

Compare the Cloudflare zone with your inventory, line by line. The places where we most often find differences:

  1. Missing MX records, or different priorities.
  2. No SPF TXT record, or two separate SPF records where only one is allowed.
  3. DKIM and _dmarc missing because they were not detected.
  4. Microsoft 365 SRV records not imported.
  5. Internal subdomains the scan had no way of knowing.

If an MX points to a subdomain delegated to other nameservers, its records must be checked at that provider, not in Cloudflare.

Orange or grey cloud

Every A, AAAA and CNAME record has a toggle: orange cloud (proxied, traffic goes through Cloudflare) or grey cloud (DNS only, Cloudflare returns the real address). Other types, such as MX and TXT, are always DNS only.

Email and non-web services

Cloudflare's proxy handles HTTP and HTTPS traffic. SMTP, IMAP and POP3 do not get through: if the MX points to mail.yourdomain.com and that A record is orange, mail stops. The documented rule is that the hostname the MX points to must also be DNS only. The same goes for webmail, cpanel, ftp, SSH access and third-party verification CNAMEs. If a provider needs a CNAME for DKIM or autodiscover and verification fails, check that CNAME flattening is not turning it into an A record.

Website

The root domain and www can be orange. Before that, set the SSL/TLS mode to Full (strict) if the server has a valid certificate. In Flexible mode Cloudflare calls the server over HTTP; if the server redirects everything to HTTPS you get a loop and the browser shows "too many redirects". Proxied records have an automatic TTL of 300 seconds, which helps when you need to fix something quickly.

Changing the nameservers

With a complete, checked zone, the switch itself takes a few minutes:

  1. Turn off DNSSEC at your registrar if it is active. Cloudflare warns that changing nameservers with DNSSEC on can make the domain unreachable. How DS records and keys work is explained in our article on DNSSEC for ecommerce domains.
  2. Copy the two nameservers assigned by Cloudflare exactly as written.
  3. In the registrar's panel, replace the current nameservers with Cloudflare's. If you do not know who the registrar is, ICANN Lookup will tell you.
  4. Do not delete the zone at the old provider: you need it for rollback.

The registrar can take up to 24 hours to apply the change. When the domain becomes active, Cloudflare sends an email and the dashboard status changes to Active. Pick a weekday morning, not Friday evening: if something breaks, you want someone around to fix it.

Checking email, website and services

As soon as the domain is active, check from outside with dig or the Dig tool in Google Admin Toolbox:

  • dig NS yourdomain.com: Cloudflare's nameservers should appear.
  • dig MX yourdomain.com +short: same servers and priorities as your inventory.
  • dig TXT yourdomain.com and the DKIM selector record: SPF and key present.

Then the practical tests. Send an email to a Gmail and an Outlook address and open the original headers: SPF, DKIM and DMARC should all pass. Have someone send you an email from an outside address. Open the site with and without www, over HTTP and HTTPS, and test any forms that send email. Finally, check services that verify the domain through DNS, such as Search Console. For mail record values with Google Workspace and Microsoft 365, see our article on business email on your own domain.

Once everything works, re-enable DNSSEC in Cloudflare and add the new DS record at your registrar.

Rolling back if something goes wrong

Most problems are solved without going back. If a record is missing, add it in Cloudflare: changes apply right away. If mail is not arriving, the first thing to check is the cloud colour on the record the MX points to. If the site loops, check the SSL/TLS mode.

A full rollback is only needed when problems are widespread and you cannot find the cause. In that case, put the old provider's nameservers back at the registrar. This only works if the old zone is still intact, which is why you should not delete it for at least a few weeks. Going back also takes time, because resolvers keep the previous nameservers in cache.

After the move, Cloudflare's reports help you see how much traffic is served from cache, as we explain in our article on Cloudflare Analytics. If you would rather have us plan and run the DNS move, with the inventory and mail checks included, get in touch.

Frequently asked questions

Why are emails not arriving after moving to Cloudflare?

Usually an MX, SPF or DKIM record is missing from the Cloudflare zone, or the A record the MX points to is proxied (orange cloud). Mail does not pass through the HTTP proxy, so that hostname must be DNS only.

How long does the nameserver change to Cloudflare take?

The registrar can take up to 24 hours to apply it. When the domain becomes active, Cloudflare sends an email and the dashboard status changes to Active.

Do I need to move my domain or hosting to Cloudflare too?

No. Only the nameservers change: the domain stays with your registrar, and hosting and mail provider stay the same. Cloudflare becomes the manager of the DNS zone.

What should I do with DNSSEC before the move?

Turn it off at the registrar before changing nameservers, because Cloudflare warns the domain may become unreachable. After activation, re-enable it in Cloudflare and add the new DS record.

Sources

  1. Full setup: change your nameservers — Cloudflare Docs
  2. Proxy status — Cloudflare Docs
  3. Email issues — Cloudflare Docs
  4. ERR_TOO_MANY_REDIRECTS — Cloudflare Docs
  5. ICANN Lookup — ICANN
  6. Dig (DNS lookup) — Google Admin Toolbox

Related articles

Tell us what isn't working.

We reply within one business day with a first opinion and, if it makes sense, a quote.

Write to us