Skip to content

What Is DKIM? Selectors, Keys and Signatures Explained

How DKIM signs email, what selectors are, how to find your DKIM record and which key sizes to use.

Published 7 min read

DKIM (DomainKeys Identified Mail, RFC 6376) is a way for a sending domain to put a cryptographic signature on each message it sends. The receiver fetches the public key from DNS at <selector>._domainkey.<domain> and verifies that the signed headers and body were not changed in transit. A valid signature proves the message was handled by someone holding the domain's private key, and it survives forwarding in a way SPF does not.

This guide explains how DKIM signing and verification work, what selectors are, how to find your DKIM record, and which key types and sizes to use.

How DKIM works

DKIM has two halves: a private key that the sending server keeps, and a public key published in DNS.

  1. The sending server picks which headers to sign (always including From:), hashes the body, and signs the result with the private key.
  2. It adds a DKIM-Signature: header to the message. That header names the signing domain (d=) and the selector (s=).
  3. The receiver reads d= and s=, queries s._domainkey.d for the public key, and verifies the signature.
  4. If the hash of the body or any signed header does not match, the signature fails.

DKIM by itself does not tell receivers what to do with failures. It produces a pass or fail result for a domain. DMARC then checks whether that domain aligns with the visible From: domain and applies your policy.

Why DKIM matters more than SPF for DMARC

SPF validates the connecting IP. When a message is forwarded, by a mailing list or a user's auto-forward rule, the IP changes and SPF fails. A DKIM signature travels inside the message, so it still verifies after a plain forward as long as the signed content is not modified. That makes an aligned DKIM signature the most dependable way to pass DMARC. See DMARC alignment for how d= must relate to the From domain.

Anatomy of a DKIM-Signature header

Here is a signature as it appears in a received message:

DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=example.com;
  s=selector1; t=1761300000; h=from:to:subject:date:message-id:mime-version;
  bh=2jUSOH9NhtVGCQWNr9BrIAPreKQjO6Sn7XIkfJVOzv8=;
  b=dzdVyOfAKCdLXdJOc9G2q8LoXSlEniSbav+yuU4zGeeruD00lszZVoG4ZHRNiYzR...
Tag Meaning
v=1 DKIM version
a= Signing algorithm: rsa-sha256 or ed25519-sha256
c= Canonicalization for header/body: simple or relaxed. relaxed/relaxed tolerates whitespace and header case changes.
d= Signing domain. This is the domain DMARC compares with the From domain.
s= Selector. Tells the receiver which key to fetch.
h= List of signed headers
bh= Hash of the canonicalized body
b= The signature itself
t= / x= Signature timestamp and optional expiry
l= Optional body length limit. Avoid it: content appended after that length is not covered.

What is a DKIM selector?

A selector is a label that lets one domain publish several DKIM keys at once. Each sending service, or each key rotation, gets its own selector. The receiver combines the selector and domain to build the DNS name:

selector1._domainkey.example.com

Common examples you will see in the wild:

Provider Typical selector names
Google Workspace google (default)
Microsoft 365 selector1, selector2
Many ESPs Provider-specific, such as s1, s2, k1, pm, or a custom name you choose

These are defaults and conventions, not rules. Your provider's admin console shows the exact selector it uses.

How do I find my DKIM selector?

There is no way to list the selectors a domain has published. DNS does not support enumerating names under _domainkey, and DKIM was designed that way. You have three reliable options:

  1. Read a message header. Send a message from the service to an inbox you control, view the original source, and find s= in the DKIM-Signature: header.
  2. Check the sending service's settings. Google Workspace, Microsoft 365 and every ESP show the selector and the record to publish.
  3. Check your DMARC aggregate reports. The <dkim> results in aggregate reports usually include the selector each receiver saw.

Tools that "find" selectors work by guessing common names. They can confirm a guess, but they cannot prove a selector does not exist.

The DKIM DNS record

The public key lives in a TXT record at the selector name:

selector1._domainkey.example.com.  3600  IN  TXT  ( "v=DKIM1; k=rsa; "
  "p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAu5oIUmmGs2KlBZ0m3Dy0"
  "...IDAQAB" )
Tag Meaning
v=DKIM1 Version. Optional, but if present it must come first.
k= Key type: rsa (default) or ed25519
p= Base64 public key. An empty p= means the key is revoked.
t=y Testing mode. Some receivers treat failures more leniently. Remove it once DKIM works.
t=s The i= identity in signatures must exactly match d=, not a subdomain of it
h= Acceptable hash algorithms. Usually omitted.

A 2048-bit RSA public key is longer than the 255-character limit for one TXT string, so the value is split into several quoted strings that the resolver joins. Most DNS dashboards do this automatically.

CNAME delegation

Many providers ask you to publish a CNAME instead of a TXT record:

s1._domainkey.example.com.  CNAME  s1.domainkey.u1234.wl.esp.example.net.

The provider then hosts the key and can rotate it without you touching DNS. Microsoft 365 uses this pattern for selector1 and selector2. A CNAME is fine as long as the target resolves to a valid DKIM TXT record. Check it with a DKIM checker after publishing.

Which key type and size to use

RSA

RFC 8301 updated DKIM's cryptographic requirements:

  • Signers must use rsa-sha256. The older rsa-sha1 must not be used for signing or accepted by verifiers.
  • RSA keys must be at least 1024 bits, and signers should use at least 2048 bits.
  • Verifiers must be able to validate keys from 1024 to 4096 bits.

In practice, use 2048-bit RSA. It is the default at Google Workspace and most ESPs, and it is supported everywhere. 1024-bit keys still verify but are below the recommended strength, so upgrade them on your next rotation. Keys larger than 4096 bits are not guaranteed to verify.

Ed25519

RFC 8463 added ed25519-sha256. Its public keys are 256 bits, so the p= value is only 44 characters and fits easily in one TXT string. The RFC requires verifiers to implement it, but deployed support has lagged behind the standard, and many large sending platforms do not offer it.

If you want Ed25519, sign each message twice: once with RSA and once with Ed25519, using separate selectors. RFC 8463 describes this, and a receiver that cannot verify one signature can still verify the other. Do not replace RSA with Ed25519 alone.

Key rotation

Rotating keys limits the damage if a private key leaks. Selectors make rotation possible without downtime:

  1. Publish a new key at a new selector, for example s2._domainkey.example.com.
  2. Wait for DNS to propagate (at least the TTL).
  3. Switch the signer to the new selector.
  4. Keep the old key published for a few days so messages still in transit verify.
  5. Revoke the old key by publishing it with an empty p=, then remove it later.

Providers that use CNAME delegation, such as Microsoft 365, handle these steps for you.

Common DKIM mistakes

  • Signing with the provider's domain, not yours. Many ESPs sign with d=esp.example.net by default. That passes DKIM but does not align with your From domain, so it does not help DMARC. Set up custom (branded) DKIM so d= is your domain or a subdomain of it.
  • Publishing the key at the wrong name. Some DNS dashboards append the zone automatically, so entering selector1._domainkey.example.com creates selector1._domainkey.example.com.example.com. Enter only selector1._domainkey.
  • Breaking the key across strings incorrectly. A missing character or an added space inside p= makes the key invalid.
  • Leaving t=y on forever. Testing mode was meant to be temporary.
  • Modifying messages after signing. Footers added by a gateway, link rewriting or subject tagging after the signature is applied break the body hash or a signed header.
  • Relying on l=. It lets attackers append content to a signed message. Sign the whole body.
  • Never rotating. A key that has been in use for years is a key with years of exposure.

Can a message have more than one DKIM signature?

Yes. It is normal for a message to carry a signature from your domain and another from the ESP's domain. DMARC passes if any one of them verifies and aligns with the From domain.

Does DKIM encrypt email?

No. DKIM signs, it does not encrypt. The message content stays readable. For encryption in transit between servers, see MTA-STS and TLS-RPT.

Key takeaways

  • DKIM signs each message, and the public key lives at <selector>._domainkey.<domain>.
  • Selectors cannot be enumerated. Find yours in a message header or your provider's settings.
  • Use rsa-sha256 with a 2048-bit key. Add Ed25519 only as a second signature.
  • Make sure d= is your own domain so DKIM aligns for DMARC.
  • Rotate keys using a new selector, and revoke old keys with an empty p=.
  • Check SPF, DKIM and DMARC together with the full domain scan, and review Google and Yahoo's requirements if you send in volume.

Look up any selector and validate the key with the free DKIM checker.

Check your domain now