How to add a DKIM record in Cloudflare
DKIM records are generated by the service that sends your mail, such as Google Workspace, Microsoft 365 or a newsletter tool. You then publish them in your DNS. This guide covers adding them in Cloudflare.
What your provider gives you
Providers use one of two formats:
- A TXT record containing the public key (
v=DKIM1; k=rsa; p=...). - A CNAME record pointing a selector to a host the provider controls, so they can rotate keys for you.
Either way you receive a name (like selector1._domainkey) and a value.
Add the record
- Open the Cloudflare dashboard, select your domain, then DNS and Records.
- Click Add record.
- Pick the Type your provider specified,
TXTorCNAME. - Name: the selector part only, for example
selector1._domainkey. Cloudflare appends your domain. - Content / Target: the value from your provider. For TXT, paste it without surrounding quotes.
- For a CNAME, set the proxy status to DNS only (grey cloud). A proxied CNAME will not resolve to the provider’s key.
- Save.
Long keys
2048-bit keys are longer than the 255-character limit for a single DNS string. Cloudflare splits long TXT values for
you when you paste the whole key. Make sure no line breaks or spaces end up inside the p= value.
Verify
Replace the selector and domain with yours:
dig +short TXT selector1._domainkey.example.com
dig +short CNAME selector1._domainkey.example.com
Then go back to your email provider and click its verify or authenticate button. After that, send a test
message and look for dkim=pass in the headers. The header guide shows how.
Common mistakes
- Typing the full domain into Name, which can produce
selector1._domainkey.example.com.example.com. - Leaving the orange cloud on for a CNAME.
- Copying the key with extra whitespace.
- Having several services share one selector name. Each service needs its own.