What a DKIM record is and what each part does
A DKIM record is a DNS TXT record that holds the public key a receiver fetches to check your message's signature. Here is what you are pasting into DNS, tag by tag.
You have been told to add a DKIM record, and someone handed you a long string to paste into DNS. This is what that string is, where it goes, and what each part does. It stays inside DKIM itself. DMARC policy and reporting are separate topics, and other pages cover them. A DKIM record works on its own even before you think about DMARC.
What a DKIM record is and where it lives in DNS
A DKIM record is a DNS TXT record. It publishes the public half of a key pair. Your mail server signs each message with the private half. A receiving server fetches the public half from DNS and uses it to check that signature.
Gmail's guidelines say receiving servers use DKIM to verify that the domain owner actually sent the message. That is the whole job of the record. It is a public key in a public place, so anyone can check a signature against it. The private key never leaves your sending system.
The record does not sit at the root of your domain like an A record. It sits at a name built from a selector and a fixed prefix. More on that below, because the selector is the piece people paste wrong.
How DKIM verification works: signature, selector, and the DNS lookup
Every signed message carries a DKIM-Signature header. That header holds the signature itself plus a set of tags. Two of them matter for the DNS lookup: d=, the signing domain, and s=, the selector.
When the message arrives, the receiving server reads those two tags and builds a DNS name from them. It asks for the TXT record at that name. If the lookup returns a key, the server checks the signature against it. If the signature checks out, the message passes DKIM for that domain.
If the lookup returns nothing, or the key does not match the signature, the check fails. A missing record is one cause. The signature says which selector to look up, so the record has to exist at exactly that name.
A sample DKIM record, tag by tag
Here is what a DKIM record looks like. The p= value below is a placeholder. A real one is a long base64 string, and yours will be different.
v=DKIM1; k=rsa; p=MIIBIjANBgkq...
Each part is a tag and a value, separated by semicolons.
- v=DKIM1 identifies the record as a DKIM key record. It comes first.
- k=rsa names the key type. RSA is the common one.
- p= holds the public key itself. This is the long string. It is the part your email provider generates, and the part you must not edit or truncate.
Some records carry extra tags, such as one noting the key's service type. You do not need to read them all. The three above are the ones that tell you the paste worked.
One rule from Gmail matters here. Gmail's guidelines say sending to personal Gmail accounts requires a DKIM key of 1024 bits or longer. If your provider generates the key, check its length against this floor.
How the selector name and the record location connect
The selector is a label you or your provider picks. It appears in two places, and they have to agree.
First, it goes into the s= tag of the signature on every message. Second, it becomes part of the DNS name where the record lives. The name is the selector, then a fixed prefix, then your domain. If your selector is "mail" and your domain is "example.com", the record name starts with the selector and the prefix, under that domain.
This is why two records can coexist. You can publish one key under one selector and a second under another, then switch by changing which selector your mail server signs with. Old messages signed with the old selector still verify, because the old record is still there.
Who creates the record? Usually your email provider. It generates the key pair, gives you the TXT record to paste, and signs messages with the private key. Your job is to paste the record at the name the provider gives you, exactly, and not to trim the p= string. If you run your own mail server, you generate the pair yourself and publish the public half.
What a DKIM record is not: it is not SPF and not DMARC
SPF is a separate TXT record at the root of your domain. It lists the servers allowed to send for you. It says nothing about signatures, and a DKIM record says nothing about which servers may send. They answer different questions.
DMARC is a third record, and a third question. Gmail's guidelines say DMARC tells receiving servers what to do with messages that don't pass SPF or DKIM. DKIM and SPF do the checking. DMARC sets the policy for what happens next.
So no, a DKIM record does not replace SPF, and SPF does not replace DKIM. Google Workspace Help says to set up DKIM and SPF before setting up DMARC. You must turn on SPF or DKIM before you can use DMARC at all. DKIM works on its own as an authentication method. DMARC builds on top of it.
Where DKIM records sit in a full authentication setup
DMARC's standard says SPF and DKIM provide domain-level authentication but are not directly associated with the domain a reader sees in the From line. That gap is what DMARC closes. DMARC's standard says a message needs alignment between the Author Domain and an authenticated identifier to achieve a DMARC pass.
For DKIM, that means the signing domain has to line up with the From domain. Google Workspace Help says relaxed DKIM alignment is the default and accepts any valid subdomain of the d= domain. Strict alignment requires the sender domain name to exactly match the d= domain name in the DKIM mail headers. A message can carry a valid signature from any domain, which is why DMARC requires alignment rather than a bare pass.
A DKIM pass with the right alignment is one of the two ways a message passes DMARC. Google Workspace Help says a message passes DMARC if it passes SPF or DKIM with alignment. It fails only if it fails both.
This is also why DKIM matters for things beyond DMARC. The BIMI draft says BIMI selectors are modeled after DKIM selectors, and that the BIMI-Selector header must be covered by a DKIM signature that passed. A sender that relies on SPF but not DKIM may find a DKIM requirement too high a bar, the draft notes.
Checking your own record
After you paste the record, verify it. Look up the TXT record at the name your provider gave you, the one built from your selector. You should get back the string you pasted. Then send yourself a message and open the raw source. Find the DKIM-Signature header and check the d= and s= tags match your domain and selector.
A missing record means the DKIM check fails for that signature. A truncated p= string fails the same way, because the key no longer matches. Paste the whole record, at the whole name, and the lookup will work. Other headers, like the one-click unsubscribe headers, sit in the same messages, but they follow separate rules. A dead DNS name, like a SORBS lookup, returns nothing useful, so check the name before you blame the key.
Sources
Filed