How to add SPF, DKIM and DMARC records in Cloudflare DNS
Updated 10 November 2026 · 5 min read
Short answer
In Cloudflare open your domain, go to DNS → Records → Add record, choose TXT, type @ as the Name for SPF, _dmarc for DMARC and selector._domainkey for a DKIM TXT key, paste the value and save. DKIM published as CNAME (Microsoft 365, SendGrid, SES) must be set to DNS only (grey cloud), not proxied. If you turned on Cloudflare Email Routing, it adds its own SPF record, so merge rather than add a second v=spf1.
What to type in each field
| Record | Type | Name | Content | Proxy status |
|---|---|---|---|---|
| SPF | TXT | @ | v=spf1 include:_spf.google.com ~all | n/a (TXT is never proxied) |
| DKIM (key) | TXT | google._domainkey | v=DKIM1; k=rsa; p=… | n/a |
| DKIM (hosted) | CNAME | selector1._domainkey | provider's target | DNS only |
| DMARC | TXT | _dmarc | v=DMARC1; p=none; rua=mailto:… | n/a |
| MX | MX | @ | smtp.google.com, priority 1 | n/a (MX is never proxied) |
Cloudflare shows the zone name next to the Name box and appends it for you, so _dmarc becomes _dmarc.yourdomain.com. Typing the full name also works; Cloudflare strips the duplicate. TTL can stay on Auto.
The proxy (orange cloud) trap
Cloudflare's proxy rewrites A, AAAA and CNAME answers to its own addresses. For a DKIM CNAME that means receivers asking for selector1._domainkey.yourdomain.com get Cloudflare IPs instead of the provider's key, and DKIM fails with "no key for signature". Cloudflare's email-records page also notes it does not proxy SMTP on port 25, so any mail A record that MX points to must be DNS only too.
Email Routing and your SPF record
Turning on Cloudflare Email Routing (free forwarding) adds MX records and an SPF TXT record for Cloudflare. If you later add Google Workspace you end up with two v=spf1 records, which is a permanent error. Keep one record and combine what you need, or disable Email Routing if Google now receives the mail, since its MX records also compete with Google's.
Worked example: from empty zone to passing
- 1
Open the zone
Dashboard → your domain → DNS → Records.
- 2
MX first
Add record → MX → Name
@→ Mail serversmtp.google.com→ Priority 1 → Save. - 3
SPF
Add record → TXT → Name
@→ Contentv=spf1 include:_spf.google.com ~all→ Save. Cloudflare wraps it in quotes itself; you do not need to. - 4
DKIM
Add record → TXT → Name
google._domainkey→ paste the whole key. Cloudflare accepts long values and splits them into 255-character strings for you. - 5
DMARC
Add record → TXT → Name
_dmarc→ Contentv=DMARC1; p=none; rua=mailto:dmarc@yourdomain.com→ Save.
Changes on Cloudflare are usually visible within a minute or two because Cloudflare is the authoritative DNS. If they are not, check the domain's nameservers really are Cloudflare's: records in a Cloudflare zone mean nothing while the registrar still points elsewhere.
Check the result
Because Cloudflare publishes fast, you can usually re-check within a couple of minutes. Run the domain through the free ReplyDak deliverability check: it reads MX, SPF, DKIM and DMARC live from public DNS, counts SPF lookups and checks the main blocklists, with no sign-up. If your DKIM selector is not a common one, type it into the optional selector box.
More setups and errors: SPF, DKIM and DMARC by provider, DNS host and error.
ReplyDak hosts every sending domain it buys on Cloudflare and publishes MX, SPF, DKIM, DMARC and verification records automatically.
Domains, DNS, Google Workspace mailboxes and a safe warm-up ramp. $4.90 per mailbox a month, minimum 10 ($49 for 10). Microsoft 365 is coming soon.
FAQ
Should DKIM CNAME records be proxied in Cloudflare?
No. Set them to DNS only (grey cloud). A proxied CNAME returns Cloudflare's IPs, so receivers cannot find the DKIM key.
What Name do I use for SPF in Cloudflare?
@, which Cloudflare shows as your root domain.
Why do I have two SPF records after enabling Email Routing?
Email Routing adds its own SPF record. Merge it with your provider's include into one v=spf1 record, or remove whichever service you no longer use.