How to set up DKIM for your domain

DKIM signs every email you send so receivers can tell it really came from you. Here is how to switch it on in Google Workspace and Microsoft 365, and how to check it is working.

Setting up DKIM takes four steps: generate a key in your email provider, publish the DNS record it gives you, wait until the record is visible, then switch signing on. In Google Workspace that is a TXT record under the google selector; in Microsoft 365 it is two CNAME records, selector1 and selector2. Afterwards, check the key with the DKIM record checker and send a test email.

Before you start

  • You need admin access to your email provider (in Google Workspace, a super administrator) and to the DNS host where your domain's records live. Not sure which DNS host that is? Look up the NS records with the DNS lookup.
  • List every service that sends email as your domain: the mailbox provider, a newsletter tool, your CRM, the shop or invoicing system. Each one signs with its own key, so each needs its own DKIM set-up.
  • Check what is there now with the email deliverability checker; it tries 35 common selectors.

Google Workspace

  1. In the Google Admin console go to Menu → Apps → Google Workspace → Gmail → Authenticate email.
  2. Choose your domain and click Generate New Record. Pick the 2048-bit key if your DNS host supports it (Google's recommendation; choose 1024 only if it doesn't). Keep the prefix selector google unless your domain already has a key with that name.
  3. Copy the DNS Host name (google._domainkey) and the TXT record value (starts with v=DKIM1; k=rsa; p=).
  4. At your DNS host, add a TXT record with that host name and value. If the host splits long values, paste the whole value anyway; never trim it.
  5. Back in the Admin console, click Start authentication.

Google notes two waits: after you turn on Gmail for a new organisation, it can be 24–72 hours before you can get the DKIM key, and after adding the key it can take up to 48 hours for DKIM to start working (Google Workspace Admin Help, "Set up DKIM").

Microsoft 365

  1. Open the Microsoft Defender portal at security.microsoft.com/authentication (Email & collaboration → Policies & rules → Threat policies → Email authentication settings) and select the DKIM tab.
  2. Click your custom domain. The details pane shows the two CNAME records to publish: hosts selector1._domainkey and selector2._domainkey, pointing at names Microsoft gives you. Domains added since May 2025 point at names ending in dkim.mail.microsoft; older ones end in onmicrosoft.com. Copy the exact values from the portal.
  3. Add both CNAME records at your DNS host.
  4. Back on the DKIM tab, turn on Sign messages for this domain with DKIM signatures. If the portal says it can't find the records yet, wait a while and try again: Microsoft says detection takes a few minutes or longer.

Microsoft's documentation lists 1024 bits as the default key size, with 2048 available (Microsoft Learn, "Set up DKIM to sign mail from your Microsoft 365 domain", updated August 2026). Microsoft rotates between the two selectors, which is why there are two records.

Other senders (newsletters, CRM, shop)

Look for "domain authentication", "sender authentication" or "DKIM" in each tool's settings. Most give you one to three CNAME or TXT records with their own selectors. Add them exactly as given, then press the tool's verify button. Without this, those emails are signed with the tool's own domain, which doesn't count for your DMARC.

Check that it works

  1. Run the DKIM record checker with your domain and selector. You want "Valid key" and, ideally, 2048 bits.
  2. Send an email to a Gmail address, open it, choose Show original and look for DKIM: 'PASS' with domain yourdomain.com.
  3. Run the email deliverability checker to see SPF, DKIM and DMARC together.

Common DKIM set-up mistakes

MistakeSymptomFix
Host typed as google._domainkey.example.com at a DNS host that adds the domain itselfRecord ends up at google._domainkey.example.com.example.com; checker says not foundUse just google._domainkey
Part of the key lost when pasting"Key doesn't decode" in the checkerCopy the full value again from the provider
Signing never switched onKey is valid, but emails show no DKIM signature for your domainClick Start authentication (Google) or turn signing on (Microsoft)
Only the mailbox provider set upDMARC reports show DKIM failing for newslettersSet up DKIM in each sending tool

With DKIM passing, the next step is DMARC: start at p=none to collect reports, then move to quarantine and reject. The DMARC guide and the DMARC record generator walk you through it.

Frequently asked questions

Do I need DKIM if I already have SPF?

Yes. SPF breaks when mail is forwarded; DKIM survives forwarding. Google and Yahoo require bulk senders to have both, and DMARC works best with both.

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

2048-bit, if your DNS host accepts the longer record. RFC 8301 requires at least 1024 bits and recommends 2048.

Can I change my DKIM key later?

Yes. Publish the new key under a new selector, switch signing to it, and remove the old record after a few days, when no emails in transit still use it.