Back to DNS Providers Directory

How to Add DMARC, SPF & DKIM in Cloudflare

DNS hosting, CDN and security.

How to fill in the host field

In the Name field, use @ for the root of your domain, _dmarc for DMARC and <selector>._domainkey for DKIM.

SPF, DKIM and DMARC records

SPFType: TXTHost: @ (root of the domain)

Your domain must have exactly one SPF record. Do not create a second TXT record starting with v=spf1.

Generate SPF record
DKIMType: TXT or CNAME, depending on your email serviceHost: <selector>._domainkey

If the DKIM record is a CNAME, keep it DNS only. CNAME flattening can prevent email providers from reading the record.

Check DKIM
DMARCType: TXTHost: _dmarc

Cloudflare DMARC Management (Email > DMARC Management) can add a DMARC record for you.

Generate DMARC record

How to create a TXT record

  1. 1In the Cloudflare dashboard, select your domain and go to DNS > Records
  2. 2Select Add record and choose TXT as the Type
  3. 3Fill in Name and Content
  4. 4TXT records are always DNS only, so there is no proxy option to change
  5. 5Select Save

How to create a CNAME record

  1. 1In the Cloudflare dashboard, select your domain and go to DNS > Records
  2. 2Select Add record and choose CNAME as the Type
  3. 3Fill in Name and Target with the values from your email service
  4. 4Set Proxy status to DNS only. Cloudflare says records used for email should be DNS only
  5. 5Select Save

Frequently Asked Questions

Why does Cloudflare split my long TXT record?

Each string in a TXT record can have at most 255 characters, so longer values are split into several strings. For SPF, DKIM and DMARC, the receiving server joins the strings back together, so the record still works.

How long do Cloudflare DNS changes take?

Changes to your Cloudflare zone take effect globally within 5 minutes, usually much less.

What does Cloudflare DMARC Management change in my DMARC record?

If you already have a DMARC record, Cloudflare adds another rua address that uses a Cloudflare email address. If you have none, it invites you to add one. It only works with apex domains.

Monitor your email authentication

Check that the records you added in Cloudflare work and get alerts when issues arise.

Monitor 1 Domain Free - No Credit Card