Skip to content

What Is a DKIM Selector, and When Should You Rotate Your Keys?

A DKIM selector is the label that tells receivers which public key to use. Learn how selectors work, when to rotate keys, and a safe step-by-step rotation.

10 min readUpdated Nov 22, 2026By XPASS Editorial Team

What Is a DKIM Selector, and When Should You Rotate Your Keys?

What a DKIM selector is

DKIM (DomainKeys Identified Mail), defined in RFC 6376, lets a sending system attach a digital signature to each message. The receiver verifies that signature with a public key that the domain owner publishes in DNS. The question is where, exactly, the receiver finds that key. The answer is the selector.

A selector is a short label written into the DKIM-Signature header as the s= tag, next to the signing domain in the d= tag. The receiver puts the two together to build a DNS name:

selector._domainkey.signing-domain

For example, a signature with s=mail2026 and d=example.com leads the receiver to query the TXT record at mail2026._domainkey.example.com. If the record exists and contains a valid public key, the receiver can check the signature.

The selector is not a secret, a password, or a security feature on its own. It is simply an index that lets one domain publish many keys side by side. That small idea is what makes safe key rotation and multi-vendor sending possible. If you want to see how a valid signature connects to the visible From address, read DMARC alignment explained.

What a DKIM record looks like

A typical record at selector._domainkey.example.com is a TXT record whose value contains tag=value pairs separated by semicolons.

  • v=DKIM1 is the version tag.
  • k=rsa names the key type. RSA is the most common; some systems also support Ed25519.
  • p= holds the public key, encoded in Base64.
  • Optional tags such as t=y (testing mode) or s=email (service type) may appear.

A 2048-bit RSA public key is longer than a single DNS string can hold, which is limited to 255 characters. DNS software therefore splits the value into several quoted strings that are joined when read. Most control panels do this for you. A common mistake in manual editing is adding stray spaces or line breaks inside the key, which makes verification fail with a "key not found" or "bad signature" result.

Many mail services avoid this work by giving you a CNAME record instead. For example, selector1._domainkey.example.com points to a name the provider controls, so the provider can rotate the key for you without asking you to edit DNS again. If your provider supports this, it is usually the lowest-effort path.

Why a domain can have many selectors

Selectors exist so that more than one key can be active at once. In practice you will see several reasons:

Situation How selectors help
Several services send as your domain Each service gets its own selector and key, so one can be changed or removed without touching the others
A key rotation is in progress The old and new keys live under two different selectors until the old one is retired
Different environments A marketing platform and a transactional system keep separate keys, which limits the impact of a leak
Delegation to a provider A CNAME selector lets the provider manage the actual key

Selector names are chosen by whoever sets up the key. Names like default, google, selector1, or a date such as 202612 are all valid. Dated selectors make rotation easier to track, because you can see at a glance which key is new.

How to find which selectors you use

You cannot list every selector from DNS, because there is no standard command for enumerating names. The reliable way is to read it from real mail.

  1. Send a test message from each system that sends as your domain to a mailbox you control.
  2. Open the full headers (often "show original" or "view source").
  3. Find the DKIM-Signature header and read the d= and s= values.
  4. Query selector._domainkey.domain for the TXT record and confirm the key is present.
  5. Record the selector, the system that uses it, the key size, and the date it was created.

Your DMARC aggregate reports also list the DKIM domain and selector seen for each source, which helps you find senders you forgot. Our guide to SPF lookup limits uses the same inventory approach for SPF, and the two lists can be kept together.

Why rotate keys at all

DKIM security rests on the private key staying private. If it is copied, someone else can sign messages that look legitimate for your domain. Rotation limits the damage window and is also a way to keep up with cryptographic guidance. Reasons to rotate include:

  • A suspected or confirmed exposure of the private key, for example when an employee with access leaves or a server is compromised. Rotate immediately in this case.
  • A key that is too short. RFC 8301 sets 1024 bits as the minimum for RSA signing and verifying, and 2048 bits is the widely recommended size today. Keys shorter than 1024 bits should be replaced.
  • A change of mail provider or system, where the old provider no longer needs to sign for you.
  • A routine schedule. There is no single interval required by the standard. Many organizations choose once or twice a year; what matters is picking a cadence you can actually keep and writing it down.

Rotation does not need to be dramatic. A well-prepared rotation is a short change with no visible effect on recipients.

A safe rotation, step by step

The goal is that at every moment, any message in flight can still be verified. That means the old key stays published until after the signing system has switched and delivery delays have passed.

  1. Generate a new key pair. Your mail system or provider normally does this. Choose 2048-bit RSA unless your provider recommends otherwise.
  2. Pick a new selector name. A date-based name such as 202612 keeps things readable.
  3. Publish the new public key in DNS at the new selector name. Do not touch the old record yet.
  4. Wait for DNS propagation. Query the new record from more than one resolver to confirm it is visible. The old record's TTL does not matter here because you are adding a new name, not editing an existing one.
  5. Switch the signing system to the new selector and private key.
  6. Send test messages and confirm DKIM passes with the new s= value. Check that the d= domain is still aligned with your From address.
  7. Keep the old selector record published for a while. Messages may sit in queues or be delivered late, and receivers verify at the time of delivery. A common practice is to wait several days to a couple of weeks.
  8. Remove the old record, or replace its value with an empty p= to explicitly revoke it. Keep a note of when and why.

If you use a CNAME-managed key, the provider usually follows a similar process on its side. Check their documentation so you know whether you need to do anything.

Mistakes that break DKIM during rotation

  • Deleting the old record too early, so mail in transit fails verification.
  • Switching the signing system before the new record is visible in DNS.
  • Publishing the new key under the same selector name as the old key. Overwriting a record means there is a window in which signatures and keys do not match. Prefer a new selector.
  • Copying a key that has been altered by a text editor, such as smart quotes, line breaks, or truncation.
  • Forgetting a second system that also signs with the old key, for example a backup mail relay.
  • Treating DKIM failure as harmless. If SPF is also unaligned, DMARC can fail and, at an enforcing policy, mail can be quarantined or rejected. See DMARC alignment explained for why this matters.

Limits and what to watch for

  • DKIM verifies that a message was signed by a key published by a domain and that the signed parts were not altered. It does not say the message is trustworthy or that the sender is who they claim to be.
  • Some mailing lists and gateways modify the subject or body and break signatures. A failed DKIM on a forwarded message is not always an attack.
  • A longer key is stronger but heavier in DNS. A 2048-bit key fits comfortably if you let your DNS host split it into strings; a 4096-bit key can run into packet size and tooling problems, so check support before using one.
  • Some DNS providers silently change the formatting of long TXT values. Always verify the published record by querying it back.
  • Rotation does not fix a leaked key retroactively. Messages signed with the leaked key before you rotated may still verify if a receiver checks them later and the old record still exists, so remove or revoke the old record promptly after a real incident.
  • DKIM keys are also used when you enable brand indicators. A domain that wants a logo displayed next to its mail normally needs DKIM and enforced DMARC first, which is covered in BIMI explained.

A short worked example

A small consultancy sends from example.com through its mailbox provider and a newsletter tool. The mailbox provider uses selector1 as a CNAME and manages rotation itself. The newsletter tool uses a TXT key under the selector news2025 that was created two years ago with a 1024-bit key.

The administrator decides to replace it. She generates a new 2048-bit key in the newsletter tool, which proposes the selector news202612. She publishes the TXT record, queries it from two resolvers, and then switches the tool to sign with the new selector. A test message shows s=news202612 and a DKIM pass aligned with example.com. She leaves news2025 published for ten days, checks the DMARC reports for any failures, and then deletes the old record. The whole change takes less than an hour of active work and recipients notice nothing.

Documenting your keys

Rotation is far easier when you know what you have. A simple table, kept somewhere your team can find it, is enough.

Field Example
Selector 202612
Signing domain example.com
System Newsletter tool
Key size 2048-bit RSA
Created December 2026
Owner Operations lead
Next review Six months later

Add a calendar reminder for the next review and a line in the runbook about how to revoke the key quickly if the system is ever compromised. When a person leaves the team, check whether they had access to any private key and rotate if the answer is yes. Treat the table as part of your regular mail housekeeping, alongside the SPF inventory and the DMARC report review.

Summary

A DKIM selector is the label in the s= tag that tells a receiver where to find your public key, at selector._domainkey.yourdomain in DNS. Because each selector has its own DNS name, one domain can run many keys: one per sending system, and an old plus a new key during rotation. Rotate on a schedule you can keep and immediately after any suspected exposure, use 2048-bit RSA keys, publish the new selector first, switch signing, and retire the old record only after delayed mail has cleared. Document each selector and who owns it. For managed help with authentication records alongside your mailboxes, take a look at the Email Security and Business Email pages.

Frequently asked questions

What is a DKIM selector?

A selector is a label placed in the DKIM-Signature header (the s= tag). Receivers combine it with the signing domain to find the public key at selector._domainkey.yourdomain in DNS.

Why would a domain have more than one selector?

Each sending system usually has its own key and selector, and a rotation needs an old and a new selector to coexist for a while. Different selectors never conflict because each has its own DNS name.

How often should I rotate DKIM keys?

There is no single mandated interval. Many organizations rotate on a regular schedule, for example once or twice a year, and immediately if a private key may have been exposed. Pick a schedule you can actually follow.

How do I rotate a DKIM key without losing email?

Publish a new selector in DNS first, wait for propagation, switch the signing system to the new selector, keep the old record for a while so in-transit mail still verifies, and then remove the old record.

About the author

Bob Kanokphon Thongdee, founder of XPASS VPN

Bob Kanokphon Thongdee

  • Founder of XPASS VPN
  • Co-founder of eSIMonline.asia
  • More than 7 years in online marketing
  • Founder of Cojourney Visa and Cojourney Travel

Protect your email and stop spoofing

Spam filtering and DMARC monitoring for your domain.

See email security

Keep reading

Business Email Guides

The SPF 10-Lookup Limit: What It Is and Why Going Over Breaks Email

SPF allows only ten DNS-querying terms per check. Add one service too many and the whole record can fail. Learn what counts, how to count, and how to fix it.

10 min read

Business Email Guides

What Is BIMI, and Does Your Company Email Need It?

BIMI lets supporting mailbox providers show your verified logo beside your messages. Learn the requirements, the setup steps, and when it is worth the effort.

10 min read

Business Email Guides

DMARC Alignment Explained: Why SPF and DKIM Passing Is Not Enough

DMARC does not only ask whether SPF or DKIM passed. It asks whether the passing domain matches the From address people see. Here is how alignment works and how to fix it.

10 min read