DKIM setup means generating a key pair for your domain, publishing the public key in DNS under a selector, and switching on signing in your mail provider. From then on, every message carries a signature that receivers check against that key, proving your domain took responsibility for the email and that it was not altered on the way.
For cold email, the detail that matters most is whose domain does the signing. Google Workspace and Microsoft 365 both sign by default with a domain of their own, which passes DKIM but does nothing for DMARC because it does not match your From address. The basics of all three records are in our guide to cold email deliverability; this post goes deeper on DKIM.
Key takeaways
- DKIM signs selected headers and the body with a private key, and receivers fetch the public key from selector._domainkey.yourdomain.
- Google Workspace uses a TXT record you generate in the Admin console, while Microsoft 365 uses two CNAME records pointing to keys Microsoft hosts.
- Publishing the DNS record is only half the job, because signing must also be switched on in the admin console.
- Use 2048-bit keys where your DNS host supports them, and treat 1024 bits as the minimum.
- For DMARC, the d= domain in the signature must align with the domain in your From address.
- Confirm with a real test message that DKIM passes for your own domain, not your provider's.
How DKIM signing works
When a message leaves your mail server, the server hashes the body, then signs a set of headers plus that body hash with your private key, adding the result as a DKIM-Signature header. A simplified, illustrative example:
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=example.com; s=google;
h=from:to:subject:date:message-id; bh=(body hash); b=(signature)
| Tag | What it holds |
|---|---|
| d= | The signing domain, which DMARC compares with your From domain |
| s= | The selector, which tells receivers where to find the public key |
| h= | The list of signed headers |
| bh= | A hash of the message body |
| b= | The signature itself |
The receiver reads d= and s=, fetches the public key from google._domainkey.example.com in this example, and verifies the signature. If the body or any signed header changed in transit, verification fails.
Selectors: why a domain can have several keys
A selector is a label that lets one domain publish more than one key at a time. Different services can sign for the same domain with their own keys, and keys can be rotated: you publish a new selector, switch signing to it, and remove the old key once no mail signed with it is still in transit.
Google Workspace uses the selector google unless you choose another. Microsoft 365 uses selector1 and selector2 and alternates between them when keys rotate, which is why both records must exist. Selectors are public by design.
Setting up DKIM in Google Workspace
- In the Google Admin console, go to Apps, then Google Workspace, then Gmail, then Authenticate email.
- Pick the domain. Every domain in the account, including secondary domains, needs its own key.
- Generate a new record. Choose 2048-bit unless your DNS host cannot store a value that long, and keep the default selector unless it is already in use.
- Publish the TXT record at your DNS host with the host name and value exactly as shown.
- Once DNS has updated, return to the console and click Start authentication.
Skipping step 5 is the most common mistake. Until you click it, Google keeps signing with its default domain, so DKIM passes but does not align.
Setting up DKIM in Microsoft 365
- Add and verify your sending domain in the Microsoft 365 admin center.
- In the Microsoft Defender portal, open the email authentication settings under threat policies and select the DKIM tab.
- Select your domain. The portal shows two CNAME records, for selector1._domainkey and selector2._domainkey, each pointing to a target Microsoft hosts. Copy them exactly as displayed, because the format of those targets has changed over time.
- Publish both CNAMEs at your DNS host.
- Back in the portal, turn on DKIM signing for the domain.
Until you do this, Microsoft 365 signs with your tenant's onmicrosoft.com domain, which will not align with your From address. Because the keys sit behind CNAMEs that Microsoft controls, rotating them needs no DNS edits on your side. If you are still choosing a platform, our comparison of Google Workspace vs Microsoft 365 for cold email covers the wider differences.
Key length, rotation and alignment
Key length. 2048-bit RSA keys are the current norm. 1024-bit keys are still widely accepted but are the floor, not the target. If your DNS host rejects a 2048-bit value because a single TXT string is too long, split it into several quoted strings within one record before falling back to 1024.
Rotation. Rotating keys limits the damage if a private key ever leaks. With Google Workspace, that means generating a key under a new selector, switching signing over, then retiring the old record. A common rule of thumb is to rotate on a fixed schedule.
Alignment. DMARC passes on DKIM only when d= matches your From domain. In relaxed mode, the default, the organizational domains must match, so d=example.com aligns with a From address at mail.example.com. In strict mode they must match exactly. If an outreach tool sends through its own servers and signs with its own domain, DKIM can pass while DMARC fails. Either configure custom DKIM in the tool or connect it to your Google or Microsoft mailboxes so the provider signs; our overview of cold email software touches on how tools connect.
Testing DKIM and fixing failures
Send a real message from the actual mailbox, through the actual outreach tool, to a Gmail account. Open it, choose "Show original" and look for DKIM: PASS with your own domain. In the raw headers, Authentication-Results should show dkim=pass with header.d set to your domain. You can also query the key directly with dig +short txt google._domainkey.example.com, or check a Microsoft record with nslookup -type=cname selector1._domainkey.example.com.
| Symptom | Likely cause | Fix |
|---|---|---|
| dkim=none | Signing not switched on | Enable signing in the admin console |
| Key not found | Record at the wrong host, or the domain appended twice | Correct the host name |
| Body hash did not verify | Something changed the message after signing, such as a gateway adding a footer | Stop modifying mail after it is signed |
| Signature invalid | Key truncated or pasted with extra characters | Republish the full key exactly |
| Passes, but d= is the provider's domain | Custom DKIM not active | Finish setup and start authentication |
Your DKIM checklist
- Generate a 2048-bit key for each sending domain.
- Publish it at the exact host name shown: one TXT record for Google, two CNAMEs for Microsoft.
- Switch on signing.
- Confirm DKIM passes with your own domain in "Show original."
- Check your SPF record too, then publish a DMARC policy so receivers know how to treat failures.
Our email deliverability service sets up and tests authentication on every sending domain as part of a managed outbound setup.
Frequently asked questions
Can a domain have more than one DKIM record?
Yes. Unlike SPF, DKIM allows many keys on one domain, each published under its own selector, such as google._domainkey and news._domainkey. That lets your mailbox provider and other sending services each sign with their own key, and lets you rotate keys without downtime. Each message names its selector in the signature, so receivers always know which key to fetch.
How long does DKIM take to start working?
The DNS record usually becomes visible within minutes to a few hours, depending on your DNS host and any previous record's time-to-live. Signing starts only once you switch it on in the admin console, and providers typically check that they can see the record first. Afterward, send a test message and confirm DKIM passes for your own domain before you begin warm-up.
Does DKIM survive email forwarding?
Usually, yes. Simple forwarding passes the message along unchanged, so the signature still verifies, whereas SPF typically fails because the forwarding server is not in your SPF record. That is why an aligned DKIM signature is the more reliable route to a DMARC pass. Forwarders that rewrite content, add footers or alter subject lines, as some mailing lists do, can break DKIM.
Is a 1024-bit DKIM key still acceptable?
A 1024-bit key is still widely accepted, but it is best treated as the minimum. Use 2048-bit keys where your DNS host can store them, splitting the value across quoted strings if a single string is too long. Never use keys shorter than 1024 bits. If you are on 1024 today, rotate to a 2048-bit key under a new selector.