
DKIM is the part of email authentication that proves a message really came from your domain and wasn't changed on the way. It's also the record most often set up wrong — copied between domains, left at a default that doesn't align with DMARC, or published in a format the platform no longer expects. This DKIM guide explains how signatures work, what every tag in the header means, how DKIM ties into DMARC, key length and rotation, step-by-step setup for Google Workspace and Microsoft 365, and how to fix the common failures.
SPF Checks the Path. DKIM Checks the Message.
💡 TL;DR
DKIM signs each outgoing message with a private key; receivers fetch the matching public key from DNS at {selector}._domainkey.{domain} and check the signature. For DMARC, the signing domain (d=) must align with your From domain. Use 2048-bit keys where supported, publish a separate DKIM record for every sending domain, set up Google Workspace with a TXT record and Microsoft 365 with two CNAME records, and confirm dkim=pass in a test message's headers.
SPF answers "was this server allowed to send for this domain?" DKIM answers a different question: "was this exact message signed by the domain it claims, and has it changed since?" That's why DKIM can survive some forwarding that breaks SPF — the signature travels with the message.
For cold email and business email alike, DKIM matters because receivers use it alongside SPF and DMARC to decide whether a message is trustworthy. Google's email sender guidelines expect it for bulk senders.
By the end of this DKIM guide, you'll understand how signing works and be able to set it up and troubleshoot it on both major platforms.
How DKIM Signing Works, Step by Step
Key pair. Your mail platform holds a private key; the matching public key is published in DNS.
Signing. When a message leaves, the platform hashes the body and selected headers and signs them with the private key.
Header added. A DKIM-Signature header is added to the message, naming the signing domain and selector.
Lookup. The receiving server reads the selector and domain, then looks up the public key at {selector}._domainkey.{domain}.
Verification. It recomputes the hashes and checks the signature. If they match, DKIM passes.
DMARC check. If the signing domain aligns with the visible From domain, DKIM can satisfy DMARC.
The selector is what lets one domain have several keys — for different services, or for rotating keys without downtime.
The DKIM-Signature Header, Tag by Tag
Tag | Meaning | Example |
|---|---|---|
v | Version | v=1 |
a | Signing algorithm | a=rsa-sha256 |
d | Signing domain — used for the key lookup and DMARC alignment | d=getacme.com |
s | Selector — which key to look up | s=google or s=selector1 |
c | Canonicalization — how strictly whitespace and formatting are compared | c=relaxed/relaxed |
h | Headers included in the signature | h=from:to:subject:date:message-id |
bh | Hash of the message body | bh=… |
b | The signature itself | b=… |
Any DKIM guide worth its salt starts troubleshooting with two tags: d= and s=. Together they tell you exactly which DNS record the receiver looked up. Note that you might also see an X-Google-DKIM-Signature header on messages that pass through Google — that's a Google-internal header, not your domain's DKIM signature; see what X-Google-DKIM-Signature means.
DKIM and DMARC Alignment
A message can pass DKIM and still fail DMARC. That happens when the signing domain (d=) doesn't match the From domain.
From domain | DKIM d= domain | DKIM result | Aligned for DMARC? |
|---|---|---|---|
getacme.com | getacme.com | Pass | Yes |
getacme.com | mail.getacme.com | Pass | Yes, with relaxed alignment (the default) |
getacme.com | acmeco.onmicrosoft.com | Pass | No |
getacme.com | a sending service's domain | Pass | No |
The third row is a common Microsoft 365 surprise. Microsoft 365 signs outbound mail with the tenant's initial onmicrosoft.com domain by default. That signature passes, but it doesn't align with your custom From domain. To get aligned DKIM, you have to enable DKIM for each custom domain, as described below.
Here's the advice we'd push back on: "DKIM shows pass, so we're done." Check which domain passed. Only an aligned pass helps DMARC.
Key Length and Rotation
Use 2048-bit keys where supported. Google Workspace lets you choose 2048-bit when generating a key. In Microsoft 365, the PowerShell command New-DkimSigningConfig creates a 1024-bit key by default unless you specify -KeySize 2048.
Rotate periodically. Microsoft 365 uses two selectors so one can sign while the other is rotated; Microsoft notes a rotation takes about four days before the new key signs mail.
Keep old keys briefly. When rotating manually on other platforms, leave the old public key published until messages signed with it have been delivered.
One key per domain. Never reuse a DKIM record from another domain.
DNS hosts sometimes struggle with long 2048-bit TXT values. If yours rejects the record, check whether it needs the value split into quoted strings.
Setting Up DKIM in Google Workspace and Microsoft 365
Google Workspace
Admin console → Apps → Google Workspace → Gmail → Authenticate email.
Select the domain and generate a new record (choose 2048-bit if your DNS host supports it).
Publish the TXT record at google._domainkey.{domain}.
Wait for DNS to update, then select Start authentication.
Microsoft 365
Make sure the custom domain is added and verified in Microsoft 365.
In the Microsoft Defender portal, go to Email & collaboration → Policies & rules → Threat policies → Email authentication settings → DKIM — or use Exchange Online PowerShell.
Copy the two CNAME targets exactly and publish them at selector1._domainkey and selector2._domainkey.
Enable DKIM signing for the domain once the CNAMEs resolve.
Microsoft introduced a new CNAME target format for custom domains added from May 2025, ending in dkim.mail.microsoft; older domains keep the format ending in the tenant's onmicrosoft.com domain. Microsoft's DKIM setup guide covers both. For full DNS templates per platform, see DNS templates for Google Workspace and Microsoft 365.
DKIM Guide Checklist for Every New Domain
Use this short DKIM guide checklist whenever you add a sending domain.
Domain added and verified on your mail platform
DKIM generated for this domain specifically (2048-bit where supported)
Record published at the exact host name the platform gives
Signing turned on (Start authentication in Google; enable in Microsoft 365)
DNS lookup returns the expected value
Test message shows dkim=pass with header.d= equal to your domain
DMARC record present, starting at p=none with reporting
Domain added to your inventory and monitoring
It takes ten minutes per domain and prevents the most common authentication failures. Teams that keep a written DKIM guide checklist rarely end up with the copied-record problem described earlier.
If you manage many domains, combine this checklist with reusable DNS templates and a scheduled re-check: DKIM records can disappear when someone edits DNS months later. Monitoring is covered in how to monitor email infrastructure health.
Troubleshooting DKIM Failures
Symptom | Likely cause | Fix |
|---|---|---|
dkim=fail on every message | Record copied from another domain or mistyped | Publish the domain's own key exactly |
Microsoft 365 status CnameMissing | CNAMEs not published or not yet visible | Copy targets exactly; enter only the host part in the name field; wait for DNS |
Microsoft 365 status NoDKIMKeys | No DKIM configuration created for the domain | Create the configuration in the portal or PowerShell |
DKIM passes but DMARC fails | Signing domain not aligned with From | Enable DKIM for the custom domain |
Fails only after forwarding or mailing lists | Message content changed in transit | Expected in some cases; DMARC can still pass on aligned SPF or ARC-aware receivers |
DNS host rejects the TXT record | Value too long for one string | Split into quoted strings as your host requires |
To check: dig +short TXT {selector}._domainkey.{domain} (Google), or dig +short CNAME selector1._domainkey.{domain} (Microsoft), then send a test message and look for dkim=pass with header.d= showing your own domain. Litemail configures DKIM automatically on every domain for its Google Workspace and Microsoft 365 inboxes.
Aligned DKIM on every domain, automatically — Litemail Google Workspace and Microsoft 365 inboxes come with SPF, DKIM, and DMARC configured on every domain, full admin access, dedicated US and EU IPs, and pre-warmed options. See Pre-Warmed Inbox Plans → About Litemail — Litemail provides pre-warmed Google Workspace and Microsoft 365 inboxes for cold email outreach, with automated DNS, dedicated US and EU IPs, and full admin access. Pre-warmed plans start at $39/month for 5 inboxes; add-on inboxes go as low as $4.99/inbox on the Scale plan. View pre-warmed inbox plans →
Related reading: SPF Records for Google Workspace and Microsoft 365 · X-Google-DKIM-Signature Explained · DNS Templates for Google Workspace and Microsoft 365 · SPF, DKIM and DMARC Setup Guide
Key Takeaways
This DKIM guide in one line: sign with a private key, publish the public key at {selector}._domainkey.{domain}, and check for an aligned pass.
For DMARC, the d= signing domain must align with the From domain.
Microsoft 365 signs with the onmicrosoft.com domain by default — enable DKIM per custom domain for alignment.
Use 2048-bit keys where supported; New-DkimSigningConfig defaults to 1024-bit unless set otherwise.
Microsoft 365 custom domains added since May 2025 use DKIM CNAME targets ending in dkim.mail.microsoft.
Never copy DKIM between domains; verify each with a DNS lookup and a test message.
Frequently Asked Questions
What is DKIM?
DomainKeys Identified Mail — a method that signs outgoing email with a private key so receivers can verify, using a public key in DNS, that the message came from the signing domain and wasn't altered.
How do I check if DKIM is working?
Send a test message to a Gmail address and look in the headers for dkim=pass with header.d= showing your own domain.
Why does DKIM pass but DMARC fail?
Usually because the signing domain doesn't align with the From domain — for example, Microsoft 365 signing with its onmicrosoft.com domain.
Should DKIM keys be 1024 or 2048 bits?
Use 2048 bits where your platform and DNS host support it. It's the stronger option.
Can I use the same DKIM record on several domains?
No. Each domain needs its own key or CNAME targets. A copied record fails.
What does this DKIM guide recommend for Microsoft 365?
Add and verify the custom domain, publish the two CNAME records exactly as Microsoft gives them, then enable signing for that domain.
Does Litemail configure DKIM for me?
Yes. Litemail configures DKIM, SPF, and DMARC automatically on every domain for its Google Workspace and Microsoft 365 inboxes.
Authentication That Just Works
Litemail inboxes come with SPF, DKIM, and DMARC configured, full admin access, dedicated US and EU IPs, sending history on pre-warmed plans, and free domain replacement.
Plans from $39/month · Google Workspace and Microsoft 365 · Setup in about 5 minutes
Buy Pre-Warmed Email Inboxes & Domains | Litemail — Pre-warmed Google Workspace and Microsoft 365 inboxes with automated DNS, US and EU IPs, and setup in about 5 minutes. Fresh inboxes from $2.50/inbox; pre-warmed from $4.99/inbox at scale. View plans and pricing →
Related reading: Pre-Warmed Inboxes · Microsoft 365 Inboxes · Google Workspace Inboxes · Cold Email Deliverability Guide · Litemail Home · Plans and Pricing


