Guides

DKIM setup and rotation, step by step

How do you set up DKIM and rotate keys without breaking deliverability?

Updated 2026-11-19 · By the Wovu research team · checked 2026-11-19 · 1976 words

DKIM setup and rotation come down to three things: publish a public key in DNS at a named selector, sign your mail with the matching private key, and when you replace the key, publish the new one at a different selector before you retire the old one. The selector is the design feature that makes this safe, because two public keys can exist at once and a receiver always finds the key for a message it just received.

This page walks through the steps, then shows what real senders publish: 26 public DNS lookups we ran on 2026-11-19.

What real DKIM records look like today

We queried the selectors that Microsoft, Google, SendGrid, Mailchimp and Fastmail document, on those companies' own domains, through Google Public DNS. Where a key was published, we decoded the p= value to read the RSA key size. These are the vendors' own corporate domains, not customer keys.

Name looked upWhat DNS returnedKey sizeRotation lesson
selector2._domainkey.microsoft.comCNAME to selector2-microsoft-com._domainkey.microsoft.onmicrosoft.com, then a v=DKIM1; k=rsa TXT1024-bitMicrosoft 365 publishes DKIM as CNAMEs, so Microsoft can rotate the key behind your record
selector1._domainkey.microsoft.comCNAME to selector1-microsoft-com._domainkey.microsoft.onmicrosoft.com, which has no TXT record todaynoneThe second selector can sit empty until its turn comes
s1._domainkey.sendgrid.comCNAME to s1.domainkey.u298828.wl079.sendgrid.net, TXT with t=s2048-bitOne provider, two selectors
s2._domainkey.sendgrid.comCNAME to s2.domainkey.u298828.wl079.sendgrid.net, TXT with t=s1024-bitThe pair is not the same size, so s1 and s2 were not generated together
k1._domainkey.mailchimp.comCNAME to dkim.mcsv.net, TXT k=rsa1024-bitStill in service at 1024 bits
fm1._domainkey.fastmail.comCNAME to fm1.fastmail.com.dkim.fmhosted.com, TXT n=Intentionally_Left_Blank_As_Per_DKIM_Rotation_BCP; p=revoked (empty p=)A retired selector, left in place with a note
fm2._domainkey.fastmail.comSame pattern as fm1revoked (empty p=)Same
fm3._domainkey.fastmail.comTXT v=DKIM1; k=rsa; p=MIIBIjAN...2048-bitThe live key sits next to two revoked ones
20161025, 20210112, 20221208, 20230601 at _domainkey.gmail.comTXT with an empty p= for each of the fourrevokedDated selectors, one per key generation, old ones revoked rather than deleted
google._domainkey.gmail.com, google._domainkey.google.com, zoho._domainkey.zoho.com, default._domainkey.github.comNo record (NXDOMAIN)noneA documented default selector name is not a promise: those domains sign with other selectors

How we made this: we ran each lookup against https://dns.google/resolve?name=<name>&type=TXT on 2026-11-19, followed each CNAME, and decoded the base64 p= value to read the RSA modulus length. The raw responses are saved in our research folder. We only tried the four Gmail selectors listed, so we do not know which selector Gmail currently signs with, and an empty p= there says nothing about whether Gmail signs mail. Results can change the moment any of these companies rotates a key.

Three things stand out. Keys of 1024 bits are still in production at large senders. Providers rotate by adding a new selector and revoking the old one with an empty p=, not by overwriting. And selector names are per sender, so always read the name from your own provider's setup page.

How DKIM works, in one paragraph

The sender hashes selected headers and the body, signs that hash with a private key, and adds the result as a DKIM-Signature header. The receiver reads the d= domain and s= selector from that header, looks up <selector>._domainkey.<domain> in DNS, and uses the public key to verify the hash. If the message changed in transit, verification fails. RFC 6376 defines all of it.

Step 1: generate the key pair

For a 2048-bit RSA key:

openssl genrsa -out dkim-private.pem 2048
openssl rsa -in dkim-private.pem -pubout -out dkim-public.pem

RFC 8301 says verifiers must not accept signatures from RSA keys under 1024 bits, and RFC 6376 advises 1024 as a minimum with longer keys for long-lived use. Google's own setup page recommends 2048 if your DNS host supports it, and offers 1024 only for hosts that cannot hold the longer record (Google Workspace help). The table above shows why the choice matters: some large senders still publish 1024.

Ed25519 keys (RFC 8463) are smaller, but receiver support is not universal. If your provider offers them, test with your recipients first. When in doubt, use RSA 2048.

Step 2: publish the public key

Convert the public key to a single base64 string with no PEM header or line breaks, then publish it:

selector1._domainkey.example.com.  TXT  "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A..."

The tags that matter, from RFC 6376:

  • v=DKIM1 is the version.
  • k=rsa is the key type. For Ed25519 it is k=ed25519.
  • p= is the public key. An empty p= means the key is revoked, which is how you retire a selector, as Fastmail and Gmail do in the table.
  • t=y marks the domain as testing. t=s says the d= domain in a signature must match the signing identity exactly, with no subdomains. It does not mean "sign everything".
  • h= limits the allowed hash algorithms. SHA-1 is deprecated.

Do not add the -----BEGIN PUBLIC KEY----- lines to DNS. The value is the base64 body only.

Step 3: sign with the selector

Configure your mail provider to sign with the private key and the selector you published. Hosted providers usually do this for you and show the record to publish. Defaults we saw documented or published:

ProviderUsual selector
Google Workspacegoogle (Google's default prefix)
Microsoft 365selector1, selector2
SendGrids1, s2
Mailchimpk1
Fastmailfm1, fm2, fm3

These are defaults, not guarantees. Read the provider's own page for the current selector.

Step 4: test before you trust it

Send a message to a Gmail address and an Outlook address you own, then read the original headers. You are looking for dkim=pass with header.d= set to your domain, the selector in the signature matching the DNS record you published, and dmarc=pass if you have a DMARC record. You can also run the lookup yourself with nslookup -type=TXT selector1._domainkey.example.com.

If DKIM fails, check the three usual causes: the DNS record is not visible yet, the selector in DNS does not match the selector in the signature, or a gateway or mailing list modified the message after signing. Google says a new key can take up to 48 hours to start working, and Microsoft says DNS changes can take a few minutes to 48 hours, so wait before you assume something is broken.

Rotation without a gap

Rotate on a schedule you can keep, and immediately if a private key may have leaked. Microsoft's documentation says to change the key periodically and calls this DKIM key rotation, but neither Microsoft nor Google sets a mandatory interval, so pick one you will keep.

  1. Generate a new key pair.
  2. Publish the new public key at a new selector.
  3. Configure the sender to sign with the new selector. Some providers can do this for you.
  4. Wait at least the DNS TTL plus the delivery window, then confirm that recent messages show the new selector.
  5. Revoke the old selector by publishing an empty p=.

The overlap is the whole point. If you replace the key at the same selector, messages already in flight can arrive after the old key is gone, and DKIM fails through no fault of the receiver.

On Microsoft 365 the steps are shorter, because there are always two selectors and Microsoft holds the keys. The documented command is Rotate-DkimSigningConfig -Identity <domain>, with an optional -KeySize 2048. Microsoft notes that if you move from 1024 to 2048 this way, the new size applies to the next active selector, so a second rotation may be needed before both selectors are 2048. The step-by-step is on our Microsoft 365 selector page.

Common failures

The record is at the wrong name. It must be <selector>._domainkey.<domain>, not _domainkey.<domain> alone.

Microsoft 365 with TXT instead of CNAME. Microsoft's page says to use CNAME records for Microsoft 365 and lists a TXT record in place of a CNAME among the common mistakes. It also recommends a TTL of at least 3600 seconds.

The key is split across strings. Some DNS providers wrap long TXT values. The receiver concatenates the strings, but a stray space or quote can break it.

A gateway rewrites the message. A link scanner or antivirus gateway that edits the body after signing will break the body hash. Sign after the gateway, or exclude it from the path.

Forwarding breaks SPF but usually not DKIM. That is why DKIM matters for DMARC alignment. See SPF record setup for the other half.

DKIM is not DMARC

DKIM proves the message was signed by the key holder. DMARC checks whether the signing domain aligns with the From: domain and tells the receiver what to do when it does not. Passing DKIM with a third-party domain does not automatically pass DMARC for yours. Read SPF, DKIM and DMARC in plain English for how the three fit together, and the DMARC rollout guide for the policy steps.

Doing this with Wovu

Wovu does not set up DNS, publish DKIM records or rotate your keys. That work stays with you and your mail provider. What Wovu does is find people with a public reason to hear from you, such as competitor engagers, keep the source of each signal, and draft the message. You approve the campaign once and Autopilot sends it on LinkedIn and email. Wovu does not track email opens. Wovu is a LinkedIn automation tool that finds warm leads. Plans start at $99 a month on the Companies plan (pricing), and the way in is a demo.

FAQ

How to rotate DKIM?

Publish a new key at a new selector, switch your sender to sign with it, wait for the DNS TTL and in-flight mail to clear, then revoke the old selector with an empty p=. On Microsoft 365, run Rotate-DkimSigningConfig -Identity <domain> in Exchange Online PowerShell. Do not overwrite the existing selector.

How often should DKIM be rotated?

There is no single mandated interval. Microsoft advises changing the key periodically, and you should rotate at once if a private key may have leaked. Choose a schedule your team will keep, and rotate with a new selector each time.

How to configure DKIM?

Generate a key pair, or have your provider generate one, publish the public key as a TXT record (or the CNAMEs your provider gives you) at <selector>._domainkey.<domain>, and turn on signing at the sender. Then send a test message and check for dkim=pass in the headers. The four steps above cover it.

How to set up DKIM in Microsoft 365?

Publish two CNAME records, selector1._domainkey and selector2._domainkey, pointing to the targets Microsoft shows for your domain, then enable signing for the domain in the Defender portal or with PowerShell. Microsoft says DNS can take from a few minutes to 48 hours. See our Microsoft 365 selector guide.

What does an empty p= mean in a DKIM record?

It revokes the key. Receivers treat the selector as having no valid key, so signatures made with it fail. Fastmail and Gmail both publish revoked selectors this way, as the lookups above show.

Why does DKIM pass for some recipients and fail for others?

Forwarding, mailing lists and gateways can modify the message, and some paths preserve the signature while others do not. Read the authentication results in the headers at the recipient where it fails.

How we checked this page

  • Ran 26 public DNS TXT lookups through Google Public DNS (dns.google) on 2026-11-19 for the selectors that Microsoft 365, Google, SendGrid, Mailchimp and Fastmail document, and decoded each p= value to read the RSA key size. The raw output is saved with the page's research data.
  • Read Microsoft's DKIM configuration page and Google's Workspace DKIM page on 2026-11-19 for the rotation steps, key size options and delay warnings quoted below.
  • Read RFC 6376 and RFC 8301 for the tag meanings and key size rules.

Sources checked 2026-11-19

  1. RFC 6376, DomainKeys Identified Mail (tags, selectors, revocation)
  2. RFC 8301, DKIM algorithm and key usage update
  3. RFC 8463, Ed25519 for DKIM
  4. Microsoft Learn, set up DKIM for Microsoft 365
  5. Google Workspace Admin Help, set up DKIM
  6. Google Public DNS JSON API (used for the lookups)