DKIM guide: sign your emails
DKIM adds a signature to every email, which the recipient checks against a key published in your DNS. Here is how to enable it for Microsoft 365, Google Workspace or another service, and how to choose the right key.
What DKIM is for
DKIM (DomainKeys Identified Mail, RFC 6376) signs every outgoing email with a private key, kept by your sending service. The matching public key is published in your DNS. The server that receives the email reads it and checks the signature: it proves that the email really comes from a server authorised by the domain and that it has not been altered on the way.
Unlike SPF, the DKIM signature survives an email being forwarded by an intermediate server. It is often what allows your emails to pass DMARC.
A DKIM record explained
The public key is a TXT record published under a name that starts with the selector:
google._domainkey.exemple.nc. TXT "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA…"
| Element | Meaning |
|---|---|
google | The selector: the name of the key. A domain can have several, one per sending service. |
_domainkey | Fixed part of the name, common to all DKIM keys. |
v=DKIM1 | Protocol version. |
k=rsa | Key type: rsa (the default) or ed25519. |
p=… | The public key, encoded in base64. When empty, it signals a revoked key. |
t=y | Optional: test mode. Recipients may then ignore the signature. |
Finding your selector
DNS offers no way to list a domain's selectors. To find yours, open an email you have sent and display its source (in Gmail, "Show original"; in Outlook, the message properties or source). In the DKIM-Signature header, the s= value is the selector and d= the signing domain:
DKIM-Signature: v=1; a=rsa-sha256; d=exemple.nc; s=selector1; …
Domain Check automatically tests 57 common selectors. If your provider has assigned you a unique selector, as OVHcloud or Amazon SES do, enter it in the "Custom selector" field of the result.
Enabling DKIM in Microsoft 365
Microsoft 365 holds the keys and rotates them itself: in your DNS, you only publish two aliases (CNAME), selector1 and selector2, which point to Microsoft.
- In the Microsoft Defender portal, open Email & collaboration, Policies & rules, Threat policies, then Email authentication settings, DKIM tab. Direct link:
security.microsoft.com/authentication. - Open your domain's row. If no keys exist yet, create them. The Publish CNAMEs section of the pane shows the two values to publish.
- At your DNS host, create the two CNAME records, copying these values exactly:
Domains set up before May 2025 use the older formselector1._domainkey.exemple.nc. CNAME selector1-exemple-nc._domainkey.<your-tenant>.<x>-v1.dkim.mail.microsoft. selector2._domainkey.exemple.nc. CNAME selector2-exemple-nc._domainkey.<your-tenant>.<x>-v1.dkim.mail.microsoft.selector1-exemple-nc._domainkey.<your-tenant>.onmicrosoft.com. Never rebuild these values by hand: copy the ones shown in the portal. - A few minutes later, once the CNAME records have been detected, go back to the domain's pane and turn on "Sign messages for this domain with DKIM signatures".
In Exchange Online PowerShell, the same steps are:
# 1. Create the keys, if the domain does not have any yet
New-DkimSigningConfig -DomainName exemple.nc -Enabled $false -KeySize 2048
# 2. Read the two CNAME values to publish
Get-DkimSigningConfig -Identity exemple.nc | Format-List Selector1CNAME, Selector2CNAME
# 3. Enable signing, once the CNAME records are published
Set-DkimSigningConfig -Identity exemple.nc -Enabled $true
Without the -KeySize 2048 parameter, Microsoft creates a 1024-bit key. To move an existing key to 2048 bits: Rotate-DkimSigningConfig -Identity exemple.nc -KeySize 2048. The new key starts signing after four days.
A common case: CNAME records published, signing not enabled. Both aliases exist but the last step has not been done. Emails go out without a DKIM signature from your domain. Domain Check detects this and rates it as critical.
Microsoft documentation: set up DKIM for Microsoft 365 (opens in a new tab).
Enabling DKIM in Google Workspace
- In the Google Admin console, open Apps, Google Workspace, Gmail, then Authenticate email.
- Choose your domain and click Generate new record. Select a 2048-bit key and keep the suggested selector prefix,
google. - At your DNS host, create the TXT record shown: name
google._domainkey, valuev=DKIM1; k=rsa; p=…, copied in full. - Go back to Authenticate email and click Start authentication. Google states that activation can take up to 48 hours.
Google documentation: set up DKIM (opens in a new tab).
Enabling DKIM with another provider
- In the interface of your sending service (email host, newsletter platform, CRM), look for the "domain authentication" or "DKIM" section.
- Generate a 2048-bit key. The service tells you the name to create (
<selector>._domainkey) and the value: a TXT record containing the key, or a CNAME pointing to its own servers. - Publish the record at your DNS host, then enable signing in the service.
- Repeat for each service that sends with your domain: each one signs with its own key, under its own selector.
Key length
A 2048-bit RSA key is the standard today. A 1024-bit key is considered too short, and below that it can be cracked. Ed25519 is a modern, strong alternative, but not all recipients check it yet: it is used in addition to an RSA key. In Domain Check, a 2048-bit or Ed25519 key scores 100, a key of 1024 to 2047 bits 70, and a shorter key 20.
Key rotation
Changing keys regularly limits the damage of a compromised key. The safe method: publish the new key under a new selector, switch signing over to it, wait a few days for emails in transit to be delivered, then empty the old key (p=) before deleting it. Microsoft 365 alternates between selector1 and selector2 by itself.
Common mistakes
- Signing never enabled. The DNS record is in place, but the sending service is not signing yet. This is the typical Microsoft 365 case.
- Truncated key. An incomplete copy and paste, or extra quotation marks, make the key unreadable.
- Wrong name. The full name is published twice (
google._domainkey.exemple.nc.exemple.nc) because the DNS interface already adds the domain. - Alias hidden behind a proxy. At Cloudflare, DKIM CNAME records must be set to "DNS only", without the proxy.
- Test mode left on. The
t=ytag left in place after going live: Domain Check deducts 20 points. - 1024-bit key. Still common on older set-ups, Microsoft 365 in particular.
- Third-party services not signing. A newsletter platform that signs with its own domain, rather than yours, does not help you pass DMARC.
Check your DKIM. Domain Check looks for your keys, measures their exact length and spots Microsoft 365 signing that has not been enabled. Test my domain