Skip to content
Back to blogGuide

DKIM key rotation: a safe step-by-step guide

3 min read
DKIM key rotation showing old and new selectors overlapping during DNS propagation

DKIM key rotation replaces the public/private signing-key pair used by a mail provider. The safe approach is to publish a new selector before switching signatures, verify that receivers can resolve it, allow an overlap period, and only then remove the old record.

Before rotating

Identify every system that sends as your domain: marketing platform, application mail, support desk, and transactional provider. Record each provider’s selector and signing domain. A selector is only a DNS label; the private key stays with the signer and must never be pasted into a public checker.

Choose a new selector that is unique and easy to track, such as a provider name plus a rotation date. Confirm the DNS host’s record format and whether the provider expects TXT or a CNAME delegation. Back up the current record and note its TTL.

Rotation sequence

  1. Generate or request the new key in the provider. Keep the private key within the provider or approved secret manager.
  2. Publish the new public key at newselector._domainkey.example.com.
  3. Query DNS and confirm the record is visible from public resolvers. Use the DKIM checker or the DKIM selector guide.
  4. Configure the sending provider to sign with the new selector and send a test.
  5. Inspect a received message’s DKIM-Signature and authentication results. Verify s=, d=, dkim=pass, and DMARC alignment.
  6. Keep the old public record for at least the provider’s recommended overlap and any relevant DNS/cache window. Then remove it only after all mail streams use the new selector.

Example change log

Time Action Evidence to save
Monday 09:00 Publish mail-2026q4._domainkey.example.com Authoritative DNS answer and TTL
Monday 10:00 Switch the marketing sender to the new selector Test message header showing s=mail-2026q4 and dkim=pass
Tuesday Check transactional and support streams separately One received-message header per sender
After the provider's overlap guidance Remove the old key only if no active stream signs with it DNS query plus sending inventory

The names and schedule are illustrative, not a universal cache-wait interval. Follow your provider's rotation policy and the TTL actually published in DNS. Large organizations may need a longer overlap because multiple senders and delegated DNS zones are involved.

If mail fails after rotation

Check for a typo, truncated public key, DNS host auto-appending the domain twice, stale resolver cache, or a provider still signing with the old selector. Query the exact s= and d= pair from a failed message. A valid DNS record alone does not prove the email was signed or aligned.

Do not delete the old selector immediately after publishing a new one. Multiple selectors can coexist; this is what makes staged rotation possible. For syntax, see how to check a DKIM record and DKIM explained.

Treat the private key as a credential: never email it, commit it to source control, or paste it into a public DKIM lookup. If a key is suspected compromised, ask the provider to revoke/replace it, rotate promptly, and check all systems that share the signing identity.