TL;DR
- DKIM signs outgoing mail with a private key. The receiver checks the signature against a public key published in DNS.
- The DNS record sits at
selector._domainkey.yourdomain.com. The selector lets one domain use several keys. - Google asks for a DKIM key of 1024 bits or longer for personal Gmail and recommends 2048 where your provider supports it.
Your sending platform asked you to "add a DKIM record", or a deliverability check flagged DKIM as missing or failing. Here is what DKIM is, what each part of the signature means, which key length and algorithm to use according to the standards, how to set it up and test it in five steps, and the failures that catch people out.
The short definition
DKIM (DomainKeys Identified Mail) puts a digital signature in a message header. Your mail server signs selected headers and the body with a private key. The receiving server fetches the matching public key from your DNS and checks the signature. If it matches, the message really passed through a system that holds your key and it wasn't changed on the way.
What it looks like
The signature travels in the message:
DKIM-Signature: v=1; a=rsa-sha256; d=example.com; s=mail2026;
h=from:to:subject:date; bh=...; b=...
Here d= is the signing domain and s= the selector. The receiver looks up this record:
mail2026._domainkey.example.com. IN TXT "v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUA..."
The p= value is the public key. Because the selector is part of the name, you can rotate keys by publishing a new selector and switching, and run separate keys for separate senders.
The signature tags, explained
The DKIM standard, RFC 6376, defines the tags in the DKIM-Signature header. The ones you'll see most:
| Tag | Meaning |
|---|---|
v= | Version, always 1. |
a= | Signing algorithm, for example rsa-sha256. |
d= | The signing domain. This is the domain DMARC compares with your From address. |
s= | The selector: which key, under d=, to fetch from DNS. |
h= | The list of headers that were signed. |
bh= | A hash of the message body. |
b= | The signature itself. |
c= | Canonicalization, how strictly whitespace and header formatting must match. Optional; the default is simple/simple, and relaxed/relaxed tolerates small whitespace and header-case changes in transit. |
Key length
Google's sender guidelines say that sending to personal Gmail accounts requires a DKIM key of 1024 bits or longer, and recommend 2048-bit keys where your provider supports them (Google email sender guidelines, checked 2026-11-22). Long keys sometimes need splitting over two strings in a DNS editor.
The standards say the same thing. RFC 8301 (2018) updated DKIM so that signers must sign with rsa-sha256, rsa-sha1 must not be used for signing or verifying, signers must use RSA keys of at least 1024 bits and should use at least 2048, verifiers must be able to validate keys from 1024 to 4096 bits, and they must not treat signatures from keys under 1024 bits as valid. The same RFC explains the splitting problem: a single TXT string holds 256 octets, and RSA keys much longer than 1024 bits don't fit, so 2048-bit keys are published as several strings in one record. RFC 8463 adds a second algorithm, Ed25519-SHA256, with much shorter keys; RSA stays the safe default because every verifier must support rsa-sha256; an Ed25519 key can be added under a second selector.
Why DKIM matters for senders
- It is required. The same Google page says all senders must set up SPF or DKIM, and bulk senders need both plus DMARC.
- It survives forwarding better than SPF, because the signature is in the message rather than tied to the server that delivered it.
- It feeds DMARC. DMARC passes when SPF or DKIM passes and the domain aligns with the From address.
- Your sending platform may sign for you. With cold-email tools you normally publish the keys they give you; ask your platform for the exact record.
How to set up DKIM
- Get the record from your sending platform. Your email provider or cold-email tool generates the key pair and gives you a selector and a TXT value.
- Publish the TXT record. Add it at selector._domainkey.yourdomain.com in your DNS, splitting a long key into several strings if your DNS editor needs it.
- Turn on signing. Enable DKIM signing in the platform once the record is published.
- Send a test and read the headers. Send to a mailbox you control and look for dkim=pass with your domain in the Authentication-Results header.
- Add DMARC. Publish a DMARC record so receivers know what to do when SPF and DKIM fail or don't align.
The test step matters most. A record can exist and still fail: the header to look for is Authentication-Results, which reports dkim=pass or a failure along with the domain that signed. Check that the signing domain is yours, not your platform's shared domain, or DMARC alignment will fail. Our authentication checker confirms the SPF, DKIM and DMARC records exist.
Why DKIM fails
- The message changed in transit. Mailing lists and some forwarders add footers or rewrite subjects, which breaks the body hash or a signed header.
- The record is broken. A long key split incorrectly, a stray quote or a missing part of
p=means the public key can't be parsed. - Wrong selector or domain. The record is published under a different selector than the one the platform signs with.
- The key is too short. Under RFC 8301, verifiers don't accept signatures from keys under 1024 bits.
- The platform signs with its own domain. The signature passes, but
d=doesn't match your From domain, so it does nothing for DMARC.
DKIM and email verification
DKIM tells receivers about the sender. It says nothing about whether the recipient's mailbox exists, which is what our SMTP check answers (how it works). A signed message to a dead address still bounces. In Mail Exchange's checks of 779,784 unique business addresses (17 Oct to 22 Nov 2026, mostly B2B contact lists, not a random sample of all email), 7.6% were undeliverable; perfect authentication wouldn't save a single one of those sends. See hard vs soft bounces.
To confirm your DKIM record exists, use the free email authentication checker. Note that you need to know the selector to find a DKIM record, since it isn't discoverable from the domain alone.
Sources
- Google email sender guidelines: checked 2026-11-22
- RFC 6376 (DKIM), RFC 8301 (algorithm and key size update) and RFC 8463 (Ed25519): checked 2026-11-22
Common questions
What is DKIM in simple terms?
A signature added to each outgoing email. The receiver checks it against a public key in your DNS to confirm the message came from your domain and wasn't changed.
What is a DKIM selector?
A label in the DNS name (selector._domainkey.yourdomain.com) that tells the receiver which public key to fetch. It lets a domain use several keys.
What DKIM key length should I use?
Use 2048-bit RSA where your provider supports it. Google requires at least 1024 bits for mail to personal Gmail accounts and recommends 2048, and RFC 8301 says signers must use at least 1024 bits and should use at least 2048.
Do I need both SPF and DKIM?
Google says all senders need SPF or DKIM, and bulk senders over 5,000 messages a day to Gmail need both plus DMARC. Set up both anyway.
How do I check if DKIM is working?
Send a message to a mailbox you control and read the Authentication-Results header. It should show dkim=pass with your own domain as the signing domain, not your sending platform's domain.
