← Slices

How to Move a Domain's DNS to Cloudflare Without Breaking Your Email

How to Move a Domain's DNS to Cloudflare Without Breaking Your Email

Key takeaways

  • Clean your existing DNS zone at the source before importing it into Cloudflare.
  • Cloudflare's quick scan is expected to miss records such as a DKIM record with a custom selector name, so review every record yourself.
  • Two SPF records return a permerror and two DMARC records mean DMARC is not applied, so keep exactly one of each.
  • Disable DNSSEC at your registrar before changing nameservers to prevent domain unreachability.
  • Verify propagation using public resolvers like 1.1.1.1 to bypass local DNS cache errors.

To move your domain's nameservers to Cloudflare without breaking email, clean your existing DNS zone first. Treat the new provider's imported copy as a dated snapshot. Compare every record manually before you switch.

That is the only safe sequence. A nameserver change is the moment when every DNS mistake you have collected over the years goes live at once. Or it quietly stays live.

You will learn how to spot the specific email records that break delivery. We will look at SPF, DKIM, and DMARC. You will also see why Cloudflare's automatic scan can miss entries that matter. This is a practical checklist for solo operators.

What actually changes when you switch nameservers

Clean the records at the old host, make Cloudflare's copy match exactly, turn DNSSEC off, then switch.

The moment you change nameservers, your new provider becomes the authority. Cloudflare’s copy of the zone is the truth for your domain, including every mail record. If that copy is wrong, the wrong records are what the world gets.

Cloudflare’s automatic scan is a heuristic, not a guarantee. It looks for common patterns of record type and name, and Cloudflare's own example of a record it is expected to miss is a DKIM record with a custom selector name. Their documentation says the quick scan is not tailored to your specific zone. Review every record yourself.

Here is the sequence I follow:

  1. Audit the live zone at your current DNS host.
  2. Fix any duplicate SPF or DMARC records in that source.
  3. Import into Cloudflare and compare line-by-line.
  4. Disable DNSSEC at the registrar if it is active.
  5. Update the nameservers.

This order stops the imported copy from undoing your fixes, which is exactly what nearly happened to me.

After a change like this I keep watching the site with Pulse, the monitoring I run on my own pages.

Remember, if DNSSEC is active during a nameserver swap, your domain can become unreachable. Turn it off first. Cloudflare’s setup guide is clear on this requirement.

Audit the email records you have before you touch anything

Start with the source, not the destination. Before you import anything into Cloudflare, you need a complete inventory of what is currently live. If you skip this, you are just guessing.

Write these down:

  • MX records: The order matters.
  • SPF: The exact text string.
  • DKIM: Every single selector name.
  • DMARC: The record at _dmarc.

Why the obsession? Because Gmail has strict rules now. Since February 1, 2024, senders to Gmail must have SPF or DKIM. If you send more than 5,000 messages a day, you need SPF, DKIM, and DMARC. Google's guidelines are clear on this.

In my view that makes these records the part of a DNS move you cannot afford to get wrong.

On my own domain the SPF record was out of date and the DMARC setup was broken, as I describe below. When you switch providers, gaps like that come along with you.

Think of this list as your baseline. You will compare it against the new provider’s import later. If the new copy is missing a DKIM selector, you need to know immediately.

Get the list first. Then move.

One SPF record, and it has to name who really sends your mail

A domain gets one SPF record. The specification says a domain must not have multiple SPF records, and when a check finds more than one it returns a permerror. See the SPF specification for the exact rules.

When I moved my old agency domain to Cloudflare in September 2026, its SPF record authorised only a marketing platform I had stopped using, while the MX records pointed at Google Workspace. Mail sent from that domain was failing SPF and nothing had told me.

Cloudflare's quick scan is not a validator. It looks for records that exist. It does not tell you whether a record is right.

A correct record does three things:

  1. Names the provider that actually sends your mail today.
  2. Leaves out senders you no longer use.
  3. Exists exactly once.

Check the lookup count too. The specification limits mechanisms that cause DNS queries, such as include, a and mx, to 10 in one evaluation. Go over the limit and the result is a permerror.

Before you switch nameservers, verify who actually sends your mail. Test it. If the record doesn't match reality, fix it at the source first. Then import it.

Two DMARC records count as none

A DMARC record that exists is not the same as a DMARC record that works. The specification is blunt about this. If a receiver finds more than one DMARC record for your domain, policy discovery terminates. They do not pick the right one. They do not merge them. DMARC processing is simply not applied to the message. Source: the DMARC specification

It is an easy state to end up in. One setup guide adds a record, the next guide adds another, and nobody deletes the first.

My old agency domain had two DMARC records, and one _dmarc value began with the words IN TXT, a whole zone-file line pasted into the value field. I had assumed the domain had DMARC because a record existed. The specification also says records that do not start with the v= tag are discarded, so a pasted line like that is not a usable record.

  1. Query your current _dmarc subdomain.
  2. Count the results.
  3. Delete everything except the one you intend to use.

Verify the value, not just the existence. A record with p=none is a record. A record with a syntax error is also a record, but it is useless. Cloudflare’s import tool is helpful, but it is a snapshot. It does not validate logic. It copies what is there. If your source zone is messy, your new zone will be messy.

I treat DNS hygiene as a prerequisite for any site move. Check the values. Delete the duplicates. Then, and only then, change the nameservers.

Clear out dead records at the source first

Dead records are dangerous because they look harmless until they aren't. An old DKIM key from a provider you stopped using years ago doesn't break anything immediately. It just sits there.

If you leave it in the zone, you are carrying technical debt into your new setup. Whatever the scan finds, it copies. That includes the garbage.

I want one known-good copy to compare against. If the source is messy, the snapshot is messy. You end up debugging the new provider for problems that existed in the old one.

Before the switch I removed eight dead records at the old DNS host, including DKIM keys for services I no longer used and two address records pointing at the old website platform, and I checked each change against the authoritative nameserver instead of trusting the dashboard. Cloudflare had scanned and imported the zone before that cleanup, so its copy still had the old SPF, the broken DMARC value and the dead address records. Switching nameservers then would have made the stale copy live and undone every fix with no error anywhere. I caught it by comparing the two zones before the switch, corrected Cloudflare's copy first, and confirmed DNSSEC was off.

Check the authoritative nameserver directly. Do not rely on a browser cache or a local resolver. Use dig to see exactly what the world sees.

  1. List every TXT record.
  2. Identify old DKIM selectors.
  3. Remove records for services you no longer use.

This step takes time. It is worth it.

Clean source, clean import. The alternative is chasing ghosts in your new dashboard.

Cloudflare's imported zone is a snapshot with a timestamp

When Cloudflare imports your zone, it does not mirror your current state. It creates a dated snapshot.

That distinction matters. If you let the auto-scan run and accept the results, you are trusting a pattern-matching algorithm to find everything. Cloudflare’s documentation is explicit about this limitation. Their quick scan relies on recurring patterns of record types seen across many zones. It is not tailored to your specific setup.

Their example of a record the scan is expected to miss is a DKIM record with a custom selector name. Since February 2024, Gmail requires SPF or DKIM for all senders, and DMARC for high-volume mail. Lose a DKIM record in the move and mail signed with that key can no longer be verified.

I treat the imported zone as a draft, not a final product. Here is the workflow I use before changing nameservers:

  1. Export your current zone from your old provider.
  2. Compare every record in the Cloudflare dashboard against that export.
  3. Manually verify email-specific records: SPF, DKIM, and DMARC.

Do not assume the import is complete. The snapshot is only as good as the manual review you apply to it. The rule I took from my own move: after any provider auto-imports a zone, treat its copy as a snapshot with a timestamp, not a mirror.

Turn DNSSEC off at the registrar before you change nameservers

If your domain has DNSSEC enabled, you need to turn it off at your registrar before changing nameservers. This is a hard requirement, not a suggestion. Cloudflare’s documentation is explicit: changing nameservers while DNSSEC is active can make the domain unreachable.

I confirmed DNSSEC was off on my own domain before I touched the nameservers.

The fix is simple but must happen in the right order:

  1. Log in to your registrar.
  2. Disable DNSSEC for the domain.
  3. Wait for the change to propagate.
  4. Then switch the nameservers to Cloudflare.

You can re-enable DNSSEC through Cloudflare once the domain is active and verified. Do not skip this step. A dark site is worse than whatever minor issue you were trying to fix.

I treat DNSSEC as a security feature that needs its own maintenance window. If you are managing your own infrastructure, know where this toggle lives before you need it.

Cloudflare’s full setup guide covers this specific warning in detail. Read it before you click that button.

Keep both zones identical while the change spreads

You are now in a race against the internet's memory. When you flip the switch at your registrar, the change does not propagate instantly. It trickles.

Your registrar can take up to 24 hours to update the nameservers. During the changeover some resolvers still ask the old nameservers while others ask Cloudflare. If those two sources give different answers, different people get different results for the same domain.

The fix is simple but critical. Before you change a single nameserver, make sure both zones are identical.

  1. Export your current DNS records from your old provider.
  2. Import them into Cloudflare.
  3. Verify the two lists match exactly.

Do not trust the automated import to be perfect. Cloudflare’s documentation explicitly warns that their quick scan is not guaranteed to find all existing records, and it names email records as one group to check. Cloudflare DNS documentation

If the zones differ, mail and web traffic depend on which nameserver a resolver happened to ask. This is where subtle bugs hide.

After the switch both zones served identical records, so mail was safe whichever nameservers a resolver still used. One failure I chased showed up only on my own Mac: its local DNS cache was holding old answers while public resolvers had the correct records the whole time. I made two DNS edits chasing a problem that did not exist.

Treat the 24-hour window as a live test. Use dig against public resolvers like 1.1.1.1 and 8.8.8.8 to see what they are returning. If you see a mismatch, fix the source zone immediately.

This is the only time you can afford to be paranoid. Once the old nameservers stop responding, you lose the safety net.

Test from a public resolver, not from your own laptop

Your local DNS cache lies to you. It holds onto stale records long after the world has moved on.

Never trust a local ping or browser check as the final word. If a record looks wrong on your machine, assume the cache is guilty until proven otherwise. You need to verify against a resolver that doesn’t know your history.

Cloudflare’s setup guide suggests checking with dig against public resolvers like 1.1.1.1 and 8.8.8.8. This sidesteps your own machine's cache and gives you a neutral view of the current state.

  1. Open a terminal.
  2. Run dig @1.1.1.1 yourdomain.com A.
  3. Compare the answer section against your intended records.

If the public resolver shows the correct data but your laptop shows old data, wait. Do not change the zone. Flush your local cache or wait for the TTL to expire. Changing the source based on a local artifact creates a real problem from a non-problem.

For DNS, a simple dig command is often all you need to see the truth.

A pre-switch checklist you can run in an hour

This is the moment of truth. You have cleaned the source, audited the email stack, and verified the snapshot. Now you execute.

  1. Disable DNSSEC at your registrar if it is active. If you skip this, your domain could become unreachable. See the Cloudflare setup guide for details.
  2. Confirm your SPF record is singular. Multiple records trigger a permerror.
  3. Ensure only one valid DMARC record exists. Anything else breaks policy discovery.
  4. Double-check DKIM selectors. The quick scan can miss custom ones.
  5. Update nameservers at the registrar to Cloudflare’s.
  6. Wait. Propagation can take up to 24 hours.
  7. Verify propagation using dig against 1.1.1.1 and 8.8.8.8.
  8. Re-enable DNSSEC through the Cloudflare dashboard.
  9. Send a test email to a Gmail address.

If it lands in the inbox, good. If it lands in spam, read the message headers for the SPF, DKIM and DMARC results before you change anything.

Take your time here. An hour of caution is cheap.

Our take

I think most people treat DNS migration as a simple cut-over event. It isn’t. It’s an audit.

The moment you switch nameservers, the new provider's copy of your zone becomes the live one. If your zone is messy, the mess comes with you. Cloudflare’s own documentation warns that its automated scan can miss records, like a DKIM record with a custom selector name. You cannot rely on automation to catch the errors that have been sitting in your zone for years.

My recommendation is simple: fix the source before you move the data. Clean your current zone until it is pristine. Verify every email record manually against the RFCs. Only then should you import that clean state into Cloudflare.

If you want a second pair of eyes on your DNS before a move, talk to me at Avakata. Reach out at hello@avakata.agency or call (877) 803-6027.

Frequently asked questions

Will changing nameservers to Cloudflare break my email?

Not if you clean your existing zone first. Cloudflare’s import is a snapshot that can miss records such as a DKIM record with a custom selector name, so review every email record yourself before switching nameservers.

Does Cloudflare import all my DNS records automatically?

No. Cloudflare’s documentation states that its automatic DNS records quick scan is not guaranteed to find all existing records, and its example of a record the scan is expected to miss is a DKIM record with a custom selector name. Review your records and add any missing ones before changing your nameservers.

What happens if a domain has two DMARC records?

If a receiver discovers more than one DMARC record, policy discovery terminates and DMARC processing is not applied to the message. They do not merge the records or pick the correct one; they simply stop processing DMARC entirely.

Do I need to turn off DNSSEC before changing nameservers?

Yes. Cloudflare’s documentation states that changing nameservers while DNSSEC is active can make your domain unreachable. You must disable it at your registrar before the switch, then re-enable it through Cloudflare once the domain is active.

How long does a nameserver change take to finish?

Cloudflare’s documentation advises waiting up to 24 hours while your registrar updates the nameservers. During this window, you should verify propagation using dig against public resolvers like 1.1.1.1 and 8.8.8.8.

Book a 30-min discovery →