DKIM record: what it is and how to set it up

Last updated

The short answer

DKIM adds a digital signature to every email your domain sends. The matching public key sits in a DKIM record in your domain's DNS, so the receiving server can check the message really came from your domain and wasn't changed on the way. Your email provider creates the key and shows you the record to add; you add it, then switch signing on. Do the same for every service that sends email as you. Gmail and Yahoo expect every sender to have SPF or DKIM, and bulk senders to have both.

How DKIM works

  1. Your email provider holds a private key and uses it to sign each message as it sends it.
  2. The signature travels in a hidden DKIM-Signature header, which names the signing domain (d=) and a selector (s=).
  3. The receiving server looks up the public key in your DNS and checks the signature. If anything in the signed parts changed on the way, the check fails.

What a passing signature proves, in the words of RFC 6376, is that the signed content "has not changed since it was signed", and which domain signed it. It doesn't, by itself, tell receivers to reject unsigned fakes: that is DMARC's job.

The selector and the DNS record

The selector is a label that lets one domain publish several keys, one per service. The record lives at selector._domainkey.yoursite.com. For Google Workspace the default selector is google, so the record looks like this (the key is much longer):

Name:  google._domainkey
Type:  TXT
Value: v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA…

Key size

RFC 8301, which updated DKIM's rules on keys, says signers must use RSA keys of at least 1024 bits and should use at least 2048. Google's sender guidelines recommend 2048-bit keys where your provider supports them. If your provider offers 2048, choose it; some DNS hosts need the long value split into parts, which their help pages explain.

How to set it up

  1. In your email provider's admin settings, find DKIM (Google Admin console: Authenticate email; Microsoft 365: the Defender portal's DKIM page) and generate a key or show the records.
  2. Add the record exactly as shown, wherever your domain's DNS is managed (your registrar, host or Cloudflare).
  3. Wait for the record to be visible, then go back to the provider and switch signing on. Adding the record alone isn't enough.

The SPF, DKIM and DMARC guide has the exact steps for Google Workspace and Microsoft 365.

Every service that sends as you

Newsletter tools, invoicing and booking systems, and help desks that send email from your address each need DKIM set up in their own settings, usually as one or two records with their own selector. This matters for DMARC: a service that signs with your domain lets DMARC pass even when its return address is its own. See the SPF record explained for the other half.

How to check it passes

Checklist

Questions people ask

Do I create the DKIM key myself?
Usually not. Your email provider generates the key pair, keeps the private half, and shows you the public half to add to your DNS. You copy what it gives you exactly.
Can I have more than one DKIM record?
Yes. Unlike SPF, each sending service uses its own selector, so you can have several DKIM records side by side: one for your email provider, one for your newsletter tool, and so on.
Is DKIM enough to stop people faking my email?
No. DKIM proves a signed message came from the signing domain unchanged, but receivers aren't told what to do with unsigned fakes. DMARC is what does that.
Why does my DKIM record not work after I added it?
The usual causes: the record went under the wrong name (it must be selector._domainkey on your domain), the long value was cut off or split wrongly, or you didn't switch signing on in your provider's settings afterwards.

What the free scan checks for this

These are the FocalScore checks that cover this guide's subject. Each one in your report says what it found, shows the evidence and gives the fix.

Sources

Last checked . Documentation, settings and rules change; if one of these pages now says something different, it is right and this guide is out of date. Tell us at info@focalscore.com.

  1. RFC 6376: DomainKeys Identified Mail (DKIM) Signatures
  2. Google Workspace Admin Help: Email sender guidelines
  3. Google Workspace Admin Help: Set up DKIM
  4. Microsoft Learn: Set up DKIM for your Microsoft 365 domain
  5. RFC 8301: DKIM cryptographic algorithm and key usage update