How to Set Up DKIM on Microsoft 365 and Google Workspace

DKIM setup on Microsoft 365 and Google Workspace takes three steps: generate the key in the admin portal, publish the DNS records it gives you, then switch signing on. Microsoft uses two CNAME records (selector1 and selector2). Google uses one TXT record at google._domainkey. Until you finish, mail is signed for the provider's own domain, which does nothing for DMARC.

It is one of the most skipped steps in business email. Google's sender guidelines require SPF or DKIM from everyone who sends to Gmail, and SPF, DKIM and DMARC from bulk senders. Microsoft enforces similar rules for high-volume senders to Outlook.com. If you need the background first, start with SPF, DKIM and DMARC Explained.

We run this across a mix of domains, some on Microsoft 365, some on Google Workspace, with marketing and form senders on top. The steps below are the ones we actually follow.

Before you start

You need admin access to the email platform (Security Administrator or Global Administrator in Microsoft 365, super administrator in Google Workspace), access to the DNS wherever it is hosted, and about 30 minutes of hands-on time plus some waiting.

Do one domain at a time and test before moving to the next. List every domain first, including ones that only receive mail or exist as aliases. The one you forget is the one a spoofer finds.

DKIM setup on Microsoft 365 (Office 365)

Microsoft hosts the keys itself. You publish two CNAME records that point at them, which lets Microsoft rotate keys later without you touching DNS again.

Step 1: open the DKIM settings

In the Microsoft Defender portal, go to Email & collaboration, then Policies & rules, then Threat policies, then Email authentication settings, and open the DKIM tab. The direct link is https://security.microsoft.com/authentication.

Your onmicrosoft.com domain is already signed. Custom domains usually show as not signing, with a status of NoDKIMKeys or CnameMissing.

Step 2: get the CNAME values

Select your custom domain. If it has no keys yet, turning the toggle on creates them and shows the two CNAME records to publish. For domains added since May 2025, the targets look like this:

Host: selector1._domainkey
Type: CNAME
Points to: selector1-example-com._domainkey.yourtenant.n-v1.dkim.mail.microsoft

Host: selector2._domainkey
Type: CNAME
Points to: selector2-example-com._domainkey.yourtenant.n-v1.dkim.mail.microsoft

The hostnames are the same for everyone. The targets are not: example-com is your domain with dots turned into dashes, yourtenant is the first part of your onmicrosoft.com name, and the single letter before -v1 is assigned by Microsoft and differs between tenants. Older domains may show targets ending in onmicrosoft.com instead. Both formats are valid.

This is why there is no such thing as a reliable "Office 365 DKIM record generator." The values come from your tenant. Copy them from the portal, or from PowerShell, and never build them by hand from a tutorial.

Step 3: publish both CNAMEs

Add both records at your DNS provider, even though only one selector is active at a time. Microsoft switches to the other one when it rotates keys.

Two mistakes we see constantly. Some DNS providers append your domain automatically, so typing selector1._domainkey.example.com creates selector1._domainkey.example.com.example.com. Enter just selector1._domainkey if your provider works that way. And on Cloudflare, set the records to DNS only. A proxied CNAME returns Cloudflare's addresses instead of Microsoft's and DKIM fails.

Step 4: turn on signing

Once DNS has updated, go back to the DKIM tab, open the domain and turn on signing. The status changes when Microsoft can see the records.

The PowerShell route, if you prefer it: Get-DkimSigningConfig | Format-List Name,Enabled,Status,Selector1CNAME,Selector2CNAME shows every domain and its values. A domain that is not listed needs New-DkimSigningConfig -DomainName example.com -Enabled $false -KeySize 2048 first. Then Set-DkimSigningConfig -Identity example.com -Enabled $true once the CNAMEs resolve.

Step 5: check the key length

Microsoft supports 1024-bit and 2048-bit keys. An existing domain can move to 2048-bit with Rotate-DkimSigningConfig -Identity example.com -KeySize 2048. A rotation takes about four days, and the old key keeps signing meanwhile. Microsoft's full reference is Set up DKIM to sign mail from your Microsoft 365 domain.

DKIM setup on Google Workspace

Google gives you the public key to publish yourself as a single TXT record. The default selector is google.

Step 1: generate the key

In the Google Admin console, go to Apps, then Google Workspace, then Gmail, and open Authenticate email. Pick your domain and click Generate new record. Choose 2048-bit unless your DNS provider cannot store a key that long, and leave the selector prefix as google unless something else already uses it.

If you just turned on Gmail for the domain, Google says you may need to wait 24 to 72 hours before it will generate a key.

Step 2: publish the TXT record

Do not click Start authentication yet. Add the record first:

Host: google._domainkey
Type: TXT
Value: v=DKIM1; k=rsa; p=MIIBIjANBgkqh...(long key)...

A 2048-bit key is longer than the 255-character limit for one TXT string. Most providers split it for you. Some older ones need it entered as several quoted chunks. If DKIM fails later, a truncated key is the first thing to check.

Step 3: start authentication

Back in Authenticate email, select the domain and click Start authentication. When it works, the status reads "Authenticating email with DKIM." Google allows up to 48 hours for this. Its own walkthrough is Set up DKIM.

Skip this step and Google keeps signing with its default key for a gappssmtp.com domain. The header says dkim=pass, which fools people, but it does not align with your domain for DMARC. Each domain, including secondary domains in the same account, needs its own key.

Running Google Workspace and Microsoft 365 on the same domain

This comes up during migrations, and in companies where one team lives in Microsoft and another in Google. DKIM is not the problem. The records have different names, so all three sit side by side:

Platform Type Host Value
Google Workspace TXT google._domainkey Key from the Admin console
Microsoft 365 CNAME selector1._domainkey Selector1 target from Defender
Microsoft 365 CNAME selector2._domainkey Selector2 target from Defender

SPF is where people trip. A domain can only have one SPF record, so both providers go into it: v=spf1 include:_spf.google.com include:spf.protection.outlook.com ~all. Two separate SPF records make both fail. Keep one _dmarc record as well, and remember that MX decides which platform receives mail, which has nothing to do with who can sign outbound.

What is a DKIM selector and how do I find mine?

The selector is the label that tells a receiving server which DNS record holds the public key. It is the s= value in the DKIM-Signature header, and the receiver looks up <selector>._domainkey.<your domain>.

To find yours, send a message to a Gmail address, open it, choose Show original and read the DKIM-Signature line. You should see d= set to your domain and s= set to google for Workspace, or a value starting with selector1 or selector2 for Microsoft 365. If d= shows onmicrosoft.com or gappssmtp.com, custom signing is not on yet.

Test that DKIM is working

Send from the domain to a mailbox on the other platform and check the headers. You want a DKIM-Signature with your domain in d=, and an Authentication-Results line with dkim=pass for your domain. You can also query the records directly: dig +short CNAME selector1._domainkey.example.com for Microsoft, or dig +short TXT google._domainkey.example.com for Google.

Common problems and fixes

Symptom Likely cause Fix
Microsoft still shows CnameMissing Doubled host name, typo or proxied record Look the record up and correct it
Google says the record is not found DNS not updated yet, or key truncated Wait, then confirm the full key is published
dkim=pass but for the wrong domain Custom signing never turned on Turn on signing or click Start authentication
DMARC still fails for some mail Another tool sends as your domain Set up DKIM in that tool too

That last row is the one most businesses hit. Marketing platforms, CRMs, helpdesks and website forms all need their own DKIM records. We cover those in the SPF, DKIM and DMARC guide.

After DKIM

Once DKIM passes for every sender, tighten your DMARC record, watch the reports for a few weeks and move toward enforcement. Our guide to reading DMARC reports explains what to look for, and how to turn the daily reports off once things are stable, which is what we did on our own domains.

If you would rather take it off your plate, Shiptronix, a technology advisory and services firm in Tampa, Florida, handles this through our email and domain security service: the DNS changes, the platform settings and testing for every domain you own.

Frequently asked questions

Do I need DKIM if I already have SPF?

Yes. SPF often breaks when mail is forwarded, and it checks the bounce address rather than the visible From address. DKIM survives forwarding better and aligns directly with your domain. Gmail, Yahoo and Microsoft expect both from higher-volume senders.

What is the DKIM selector for Microsoft 365 and Google Workspace?

Microsoft 365 uses selector1 and selector2, published as CNAME records at selector1._domainkey and selector2._domainkey. Google Workspace uses google by default, published as a TXT record at google._domainkey. You can confirm yours in the s= value of any sent message's headers.

Should I use a 1024-bit or 2048-bit DKIM key?

Use 2048-bit wherever your DNS provider supports it, which is almost everywhere now. In Microsoft 365, move an existing domain to 2048-bit through a key rotation. In Google Workspace, choose 2048 when you generate the record.

How long does DKIM take to start working?

DNS changes often show up within minutes. Microsoft lets you turn on signing as soon as it sees the CNAMEs. Google allows up to 48 hours after you add the record, and up to 72 hours before it will generate a key on a newly activated Gmail domain.

Can I use DKIM for Microsoft 365 and Google Workspace on the same domain?

Yes. The records use different names, so Microsoft's two CNAMEs and Google's TXT record do not conflict, and each platform signs its own mail. The thing to merge is SPF: one record that includes both _spf.google.com and spf.protection.outlook.com.