DNS host · DKIM

DKIM record for Cloudflare

How to add a DKIM record when DNS or mail is at Cloudflare. Real steps, then a live lookup.

If the domain is proxied (orange cloud), that does not affect TXT records. MX and TXT stay DNS-only.

  1. Add the TXT or CNAME your mail provider specified, name like google._domainkey.
  2. A TXT record cannot be proxied. A CNAME can be, and a DKIM CNAME must stay grey-cloud (DNS only).

Official docs: Cloudflare. Other records for this provider: SPF · DKIM · DMARC

Does this page apply to you?

Run this first. Cloudflare only matters if it is where your DNS or mail actually lives.

dig +short NS yourdomain.com

Expect: Two names ending in .ns.cloudflare.com. If you see anything else, DNS is hosted elsewhere and edits here will have no effect.

Specific to Cloudflare

  • If your provider gives you a CNAME for DKIM (Microsoft 365 and many sequencers do), set it to DNS only, the grey cloud. A proxied CNAME answers with Cloudflare's own addresses instead of the target, and the DKIM lookup fails.
  • After saving, check that the name reads selector._domainkey.yourdomain.com and not with your domain repeated.
  • For a TXT key, paste the full value as one string with no line breaks.

What you should end up with

Illustrative values. Use the exact host and value your provider shows you where it generates them.

Type  Name  Value
CNAME  selector1._domainkey  selector1-yourdomain-com._domainkey.yourtenant.onmicrosoft.com

What the receiving server does with this record

Your sending server signs each message with a private key and adds a DKIM-Signature header naming the signing domain (d=) and the selector (s=). The receiver builds the hostname s._domainkey.d, fetches the public key from DNS, and verifies the signature. A valid signature proves the message came from that domain and was not changed on the way.

Mistakes that break it

  • Published, but signing never switched on. Most providers need a second step after the DNS record exists. Until then they sign with their own domain, which passes DKIM but does not align with your From address, so it does nothing for DMARC.
  • A doubled hostname. Typing the full name into a field that already appends your domain gives selector._domainkey.yourdomain.com.yourdomain.com.
  • A damaged key. A 2048-bit key is longer than one 255-character DNS string. Stray spaces, line breaks and silent truncation all invalidate it.
  • The wrong selector. The record is published under one name and the sender signs with another.

Check it from the command line

The final test is a real message: send one to a Gmail address, open Show original, and read the DKIM line. Before that, confirm the record resolves:

dig +short CNAME selector1._domainkey.yourdomain.com

Check it live

Check the DKIM record

Look up the live DNS after you save. This tool does not spend credits.

Related