What DKIM does
DKIM (DomainKeys Identified Mail) adds a digital signature to each message as it's sent. The receiving server checks the signature against a public key in the sender's DNS. If it verifies, the receiver knows two things: the message was signed by that domain, and the signed parts haven't changed since.
Unlike SPF, DKIM doesn't care which server delivered the message. The signature travels inside the message, so it usually survives forwarding.
How signing works
DKIM-Signature header.Reading a DKIM signature
- d=
- The signing domain. For DMARC, it has to match the From domain.
- s=
- The selector: which key to fetch. Together,
s=andd=point toselector1._domainkey.yourcompany.com. - h=
- The headers that were signed.
- bh=
- A fingerprint (hash) of the message body.
- b=
- The signature itself.
The DNS record
The public key lives at selector._domainkey.yourdomain, as a TXT record:
v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA... Each service that signs for your domain uses its own selector, so you can have several DKIM records without conflicts.
Microsoft 365 and Google Workspace
| Microsoft 365 | Google Workspace | |
|---|---|---|
| Before you turn it on | Signs with your onmicrosoft.com domain, which doesn't align | Signs with a Google-owned domain, which doesn't align |
| Selectors | selector1 and selector2 | google by default |
| DNS records | Two CNAME records pointing to Microsoft | One TXT record with the public key |
| Where to turn it on | Defender portal → Email authentication settings → DKIM | Admin console → Gmail → Authenticate email |
Step-by-step: DKIM in Microsoft 365 and DKIM in Google Workspace.
When DKIM fails
- The message was changed on the way. Mailing lists that add a footer, or security gateways that rewrite links, break the signature. Receivers that support ARC can still trust the original result.
- The DNS record is missing or wrong, for example the CNAMEs were never published, or a long key was cut off by the DNS host.
- The message was never signed with your domain. The header shows
dkim=none, or a pass for a service's own domain.
A pass for the wrong domain doesn't help. dkim=pass header.d=newsletter-tool.example means the service signed with its own domain. For DMARC, the d= domain has to match your From address. See DMARC alignment.
Keys and rotation
- Use 2048-bit keys. 1024-bit keys still work but are weaker.
- Rotate keys from time to time. Microsoft 365 rotates between its two selectors without any DNS change; elsewhere, publish the new key under a new selector before switching.
- Remove keys you no longer use, and never publish DKIM records for domains that don't send email.
Common questions
#Do I need DKIM if I have SPF?
Yes. SPF breaks when messages are forwarded and never checks the From address. DKIM survives forwarding, and an aligned DKIM signature is the most reliable way to pass DMARC.
#Does DKIM encrypt my email?
No. It signs the message so receivers can confirm who sent it and that it wasn't changed. Anyone can still read the content; encryption in transit is handled separately by TLS.
#Do services like newsletter tools need their own DKIM?
Yes. Your mail platform only signs what it sends. Each service that sends as your domain needs DKIM set up for your domain in that service, with its own selector.