Changing a DKIM key is not a trivial operation: until the old DNS record has fully propagated, emails signed with the new key can land at a recipient still querying the old one, and vice versa. Without precautions, rotation breaks the DKIM signature of hundreds of emails in transit, hitting deliverability at the worst possible moment — right after a change meant to strengthen security.
Why rotate a DKIM key at all
DKIM rotation follows two different logics. The first is preventive: a 1024-bit RSA key, still common on older setups, has been considered weak for years, and a 2048-bit key that has been in place for a long time benefits from renewal as a matter of hygiene, much like a TLS certificate. The second is reactive: a private key exposed in a code repository, a poorly protected configuration export, or a sending provider changing infrastructure, all call for immediate rotation, without waiting for the usual cycle.
Either way, the principle stays the same: publish the new key before signing a single email with it, and keep the old one in place long enough for everyone to verify it one last time.
The two-selector principle
DKIM identifies each key by a selector, an arbitrary name placed before ._domainkey in the DNS record. That selector, carried in the s= parameter of every email’s DKIM-Signature header, tells the receiving server which TXT record to fetch. Changing the key without changing the selector amounts to overwriting the old record: any email still queued or cached with the old signature fails verification.
Best practice is to publish the new key under a new selector, leaving the old one active in parallel. Both records coexist in the DNS zone, and only the sending server’s configuration decides, at any given moment, which of the two selectors signs outgoing messages.
; Old selector, still published during the transition
mail2025._domainkey.example.com. IN TXT "v=DKIM1; k=rsa; p=MIGfMA0GCSq...oldKey...IDAQAB"
; New selector, published before any signing with the new key
mail2026._domainkey.example.com. IN TXT "v=DKIM1; k=rsa; p=MIGfMA0GCSq...newKey...IDAQAB"
Step-by-step, with zero downtime
Rotation runs across several stages, spaced out to absorb DNS propagation and give resolver caches time to catch up. The TTL of the existing TXT record sets the minimum duration of each stage: no point rushing a step before the old TTL has elapsed at least once.
| Step | Action | Recommended duration |
|---|---|---|
| 1. Preparation | Generate the new key pair and publish the new selector in DNS, without signing with it yet | Before any signature change |
| 2. Propagation wait | Let the new selector propagate across public resolvers | At least one full TTL, 24 to 48h to be safe |
| 3. Signing cutover | Configure the sending server to sign with the new selector | Immediate, once step 2 is confirmed |
| 4. Overlap period | Keep the old DNS record published, in case delayed external queues still use the old signature | 7 days minimum |
| 5. Retirement | Remove the old TXT record once the overlap period has passed without incident | After confirmation in DMARC reports |
Changing the selector, not just the key, is what lets the old and new DKIM signatures coexist long enough for DNS propagation to catch up with the handover.
Before retiring the old selector, aggregate DMARC reports let teams confirm that no traffic has signed with it for several consecutive days: a monthly scheduled send or a third-party service forgotten during the handover can keep using the old key for weeks after the main cutover, exactly what regularly reading rua reports is built to catch before it becomes a problem.
Verify publication before signing
The simplest way to confirm a DKIM record is publicly visible is a direct DNS query against the selector in question, run from a network outside the sending infrastructure to avoid false positives from an internal resolver that might already have the new record cached.
dig TXT mail2026._domainkey.example.com +short
# Expected result, as a single logical line
"v=DKIM1; k=rsa; p=MIGfMA0GCSq...newKey...IDAQAB"
The mistakes that break deliverability mid-rotation
DKIM rotation rarely fails on principle; it fails on execution. Three mistakes come up over and over: overwriting the old TXT record instead of adding a second one, which instantly invalidates any signature still in transit under the old selector; cutting over to the new signature before confirming full propagation of the new selector, especially on the most widely used public DNS resolvers; and forgetting a third-party service that signs for the same domain, such as a marketing email tool separate from the transactional server, which keeps using the old selector long after the infrastructure team has retired it.
That last case is the most common in practice: a domain rarely sends from a single platform, and every third-party service signing DKIM for that domain needs to be inventoried before any rotation, not discovered afterward in a failure report.
When rotation is handled by a third-party provider
Transactional or marketing sending platforms that manage DKIM signing on behalf of their customers, as most consumer-facing ESPs do, generally rotate on their own end with no action required on the sending domain, since the selector and key belong to them. The risk shifts elsewhere: a domain sending from several such platforms in parallel must make sure none of the distinct DKIM signatures gets accidentally removed from the DNS zone during a cleanup, a common scenario when a marketing team switches tools without telling whoever manages the DNS.
Conversely, a domain that signs its own emails, through a self-hosted SMTP server or an internally managed DKIM setup, owns the entire procedure described above, including key creation and TXT record publication.
Recommended cadence
Outside of a confirmed compromise, which calls for immediate rotation, a twelve-to-twenty-four-month cycle remains a reasonable benchmark for a 2048-bit RSA key, with no particular urgency to tighten it further. Switching sending providers, merging two domains, or moving to a new email platform are, on the other hand, triggers to act on right away, since they almost always come with a new key pair anyway. Mailboxes that now accept Ed25519 as an alternative to RSA can also use a planned rotation to migrate toward shorter, faster-to-verify keys, provided the domain’s usual recipient servers support it first, which is not yet universal.
Key takeaways
Rotating a DKIM key hinges on the selector, not the key itself: publishing a new selector alongside the old one, confirming its propagation before cutting over the signature, and keeping the old record for an overlap period are the three safeguards that prevent a deliverability break. Inventorying the third-party services that sign for the domain remains the most commonly overlooked step, and the costliest to discover after the fact.
On a recent rotation, the incident didn’t come from the main domain but from a newsletter tool configured two years earlier that was still signing with the old selector — nobody on the team knew it signed DKIM for that domain at all. Before any rotation, it’s worth listing everything that sends an email on the domain’s behalf, even the tools everyone forgot about — Simon Janvier.
Further reading: the SPF, DKIM and DMARC knowledge base and the guide on aggregate DMARC reports on Mail Studio.
