On this page
  1. What a DKIM record does
  2. Where the record lives
  3. The tags in a DKIM record
  4. Key length
  5. TXT or CNAME
  6. Publishing the key and turning DKIM on
  7. How to check your DKIM record
  8. Sources

A DKIM record is a Domain Name System (DNS) (opens in a new tab) TXT record that holds the public half of a DomainKeys Identified Mail (DKIM) (opens in a new tab) key pair. It is published at selector._domainkey.example.com, and receivers fetch it to verify each signature; DemiSignal's DKIM generator makes one for your own mail server. With a sending service, the service creates the key pair and tells you which selector record to publish, as DemiSignal's DKIM check notes. In Google Workspace (opens in a new tab), you then turn on DKIM as a separate step.

What a DKIM record does

DomainKeys Identified Mail (DKIM) (opens in a new tab) lets an organisation claim some responsibility for a message by associating its domain name with it. That claim is validated through a cryptographic signature and by querying the signer's domain for the matching public key. The verifier retrieves the key from the signer's DNS (opens in a new tab), and the standard defines one way to publish keys there: DNS TXT records.

Each DKIM key is one key pair: the public half in DNS, the private half on the server that signs. The DKIM record is only the public half.

In security terms, Google's DKIM help (opens in a new tab) says DKIM helps protect your domain against spoofing by authenticating your email with a DKIM signature. Receiving servers use your public DKIM key to read that signature. Sender Policy Framework (SPF) (opens in a new tab) and Domain-based Message Authentication, Reporting, and Conformance (DMARC) (opens in a new tab) are the other two checks; SPF, DKIM and DMARC side by side shows which domain each one looks at.

Check your domain now

See the SPF, DKIM and DMARC records your domain publishes and what to fix first. Free, no account needed.

Where the record lives

All DKIM keys are stored under a subdomain named _domainkey (opens in a new tab). In a DKIM signature (opens in a new tab), the d= value is used to form the query for the public key, and the s= tag is the selector that subdivides the namespace for that domain. So a signature with d=example.com and s=selector1 sends the receiver to selector1._domainkey.example.com.

Selectors (opens in a new tab) exist so one domain can publish several public keys at once. TXT records must be unique for each selector name: the standard (opens in a new tab) leaves the result undefined when one name has several TXT records. A TXT record can hold several strings, and receivers join them with no spaces before use.

A real example, checked against live DNS: google._domainkey.demisignal.com holds a TXT record that begins with v=DKIM1;k=rsa;p=.

How selectors are named and where to find yours is covered in the DKIM selector guide. Several DKIM keys under different selectors are normal; two TXT records at the same selector conflict, and the multiple DKIM records guide covers how to keep one.

The tags in a DKIM record

RFC 6376 section 3.6.1 (opens in a new tab) defines the tags a DKIM record can carry:

Tag Meaning Required? Default
v= Version. If present, it must be DKIM1 and must be the first tag. Recommended DKIM1
k= Key type. Every signer and verifier must support rsa. Optional rsa
p= The public key, base64-encoded. An empty value means the key has been revoked. Required none
h= Hash algorithms the key may be used with. Optional all algorithms allowed
s= Service types the record applies to, separated by colons. Optional *
t= Flags, separated by colons. Optional no flags
n= Notes for a human. No program interprets them. Optional empty

The flags defined for t= are y and s. With t=y the domain is testing DKIM, and verifiers must treat its messages like unsigned mail even when the signature fails. With t=s, the domain in a signature's i= tag must be the same as d=, not a subdomain of it. Tags a verifier does not understand are ignored.

RFC 8463 (opens in a new tab) adds the key type k=ed25519, where p= carries an Ed25519 public key in base64.

In practice, DemiSignal's DKIM generator produces v=DKIM1; k=rsa; p= followed by the public key.

Key length

RFC 8301 (opens in a new tab) says signers must use RSA keys, the default DKIM key type (opens in a new tab), of at least 1024 bits and should use at least 2048 bits. Verifiers must not accept signatures made with RSA keys shorter than 1024 bits.

DemiSignal's DKIM check treats 2048 bits as the recommendation: 1024-bit keys still pass but are weaker, and Ed25519 keys are short by design. Most services let you switch to a 2048-bit key in their admin settings.

A 2048-bit record is longer than 255 characters, the limit for one TXT string. The DKIM generator notes that most DNS hosts split it for you; if yours does not, publish the record as several quoted strings, in order. Changing a key safely means a new selector, covered in DKIM key rotation.

TXT or CNAME

Some services ask you for a CNAME record instead of a TXT, so that the service manages the key.

Microsoft 365 (opens in a new tab) works this way. Its selector names are selector1 and selector2 for every organisation, the CNAME delegates key management to Microsoft, and Microsoft 365 handles key rotation automatically. A TXT record would mean managing keys and rotation yourself, which Microsoft 365 does not support. Twilio SendGrid (opens in a new tab) does the same with automated security on: you publish three CNAME records, and SendGrid manages your DKIM and SPF records.

Checked against live DNS, selector2._domainkey.microsoft.com is a CNAME to selector2-microsoft-com._domainkey.microsoft.onmicrosoft.com, and the TXT record at selector2-microsoft-com._domainkey.microsoft.onmicrosoft.com begins with v=DKIM1; k=rsa; p=.

The tenant-specific CNAME values are covered in the Microsoft 365 setup guide.

Publishing the key and turning DKIM on

In Google Workspace (opens in a new tab), publishing the record and turning DKIM on are separate steps. Google's setup has three: generate a DKIM key pair in the Admin console, add the DKIM key to your domain as a DKIM TXT record, then turn on and verify DKIM. Google's instructions say "Do not click Start Authentication yet" and that you will do that later.

To turn DKIM on, you select the domain where you want to turn on DKIM and click Start authentication. After adding a DKIM key, it can take up to 48 hours for DKIM authentication to start working. When DKIM setup is complete and working correctly, the status at the top of the page changes to "Authenticating email with DKIM".

For other services, DemiSignal's DKIM check points to the admin settings of the service that sends the email: the service creates the key pair and tells you which selector record to publish. The private key never leaves that service. The Google Workspace setup guide walks through each value.

How to check your DKIM record

DemiSignal's DKIM check looks for the keys a domain publishes under common and provider selectors and reports each key's type and size. It also tries the selectors that your SPF and MX (mail exchange) (opens in a new tab) records point to. It reads public DNS only: nothing is changed and no email is sent. A record with an empty p= revokes a key, and mail signed with it fails DKIM.

A key that is not found does not prove the domain has no DKIM. A service that uses its own selector name will not be found by trying common names; the selector is in the s= tag of the DKIM-Signature header of an email it sent.

If receivers report dkim=fail, the DKIM fail guide explains how to read the reason in brackets and fix the message path, the DNS record or the key that does not match.

To see DKIM next to SPF and DMARC for your domain, the DemiSignal check reads all three with no account needed.

Sources

Tools for this

Frequently asked questions

Where is a DKIM record published?

At a name made of the selector, then _domainkey, then your domain, for example selector1._domainkey.example.com. Each selector holds one key.

Does publishing a DKIM record turn on DKIM in Google Workspace?

No. Google tells you not to click Start Authentication yet while you set up the key; you turn on DKIM later by selecting your domain and clicking Start authentication.

Should a DKIM key be 1024 or 2048 bits?

RFC 8301 requires RSA keys of at least 1024 bits and recommends at least 2048 bits. Use 2048 unless your DNS host cannot publish the longer record.

Check your domain now

See the SPF, DKIM and DMARC records your domain publishes and what to fix first. Free, no account needed.