Key takeaways
- DKIM adds a cryptographic signature to outgoing emails for authentication.
- The public key for DKIM is stored in a DKIM record in DNS under a specific selector-specific name.
- DKIM helps prevent direct domain spoofing, supports DMARC, but doesn't guarantee inbox placement or message safety.
- DKIM protects content integrity, establishes domain accountability, supports DMARC, and meets mailbox-provider requirements.
- Gmail and Yahoo have specific requirements for senders, including SPF or DKIM authentication.
DKIM (DomainKeys Identified Mail) is an email authentication standard that adds a cryptographic signature to outgoing messages. A receiving server retrieves the corresponding public key from DNS and uses it to check whether the signature is valid and whether signed content changed in transit.
The public key is published in a DKIM record under a selector-specific DNS name. DKIM makes direct domain spoofing harder and supports DMARC, but it does not guarantee inbox placement or prove that a message is safe.
What is a DKIM record?
A DKIM record is a DNS record that contains the public key used to verify messages signed by a particular domain and selector. It is related to, but different from, the DKIM signature added to an email header.
Three terms are easy to confuse:
- DKIM is the authentication standard.
- DKIM-Signature is the header added to a signed message.
- DKIM record is the DNS record containing the public key used by receivers.
The signature identifies the signing domain in the d= tag and the selector in the s= tag. A receiver combines them to query a host such as selector1._domainkey.example.com.
Quick answer
DKIM authenticates a domain’s responsibility for a message. It does not authenticate a person or mailbox, and it does not necessarily authenticate the visible From address by itself. DMARC checks whether the DKIM signing domain aligns with the From domain.
Why DKIM is important
- It protects signed content. A valid signature shows that the signed headers and body survived verification.
- It establishes domain-level accountability. The signer demonstrates control of the private key associated with the DNS-published public key.
- It supports DMARC. Aligned DKIM can let a message pass DMARC even when forwarding breaks SPF.
- It helps meet mailbox-provider requirements. Major providers expect authenticated mail, especially from bulk senders.
DKIM can prevent avoidable authentication failures and support deliverability, but reputation, consent, engagement, list quality, and content still influence filtering.
Google and Yahoo requirements
Gmail requires SPF or DKIM for senders to personal Gmail accounts. Senders above Google’s bulk threshold must use SPF, DKIM, and DMARC, and the visible From domain must align with either SPF or DKIM. Yahoo also requires authentication from bulk senders. Review the providers’ current guidance and our overview of the Google and Yahoo rules before a major launch.
How DKIM works
DKIM uses a private and public key pair. The sending system keeps the private key secret and uses it to create a signature. The public key is published in DNS so receiving systems can verify that signature.
- The sending service canonicalizes the selected headers and message body.
- It calculates a body hash and creates a signature with the private key.
- It adds a
DKIM-Signatureheader containing the signing domain, selector, algorithms, signed-header list, body hash, and signature value. - The receiver reads the
d=ands=tags and looks up the public key ats._domainkey.d. - The receiver verifies the body hash and signature, then records a result such as
dkim=passordkim=fail.
The private key does not encrypt the message or its headers. DKIM is a signature-verification mechanism, not end-to-end encryption.
DKIM record example
A simplified DNS TXT value can look like this:
| Host | Value |
selector1._domainkey.example.com |
v=DKIM1; k=rsa; p=PUBLIC_KEY |
| Tag | Meaning |
v |
Record version. For DKIM, this is DKIM1. |
k |
Public-key type, commonly rsa. |
p |
Base64-encoded public key. An empty value revokes the key. |
t |
Optional flags, such as testing mode. Most records omit it. |
Use the exact host and value supplied by your email service. DNS interfaces handle domain suffixes and quotation marks differently, so avoid adding the domain twice or copying decorative quotation marks into the key.
What the DKIM-Signature header contains
| Tag | Purpose |
v |
DKIM version. |
a |
Signing algorithm. |
c |
Header and body canonicalization methods. |
d |
Signing domain. |
s |
Selector used to find the public key. |
h |
Headers included in the signature. |
bh |
Hash of the canonicalized body. |
b |
Cryptographic signature value. |
t / x |
Optional signing and expiration timestamps. |
Canonicalization defines how harmless formatting differences are normalized before verification. A signature may use simple or relaxed handling for headers and the body.
Selectors, key length, and rotation
A selector lets a domain publish more than one public key. Different providers can use different selectors, and a service can introduce a new selector during rotation without interrupting messages signed with the previous key.
Use 2048-bit RSA keys where the sending service and DNS provider support them. Keep private keys only in the signing system, rotate a compromised key immediately, and retire old public keys after messages signed with them no longer need verification. Record which team or vendor owns every selector.
DKIM, SPF, and DMARC: how they work together
| Protocol | What it checks | Identity used | Common limitation |
| SPF | Whether the connecting IP is authorized | MAIL FROM / Return-Path or HELO domain | Forwarding can break it |
| DKIM | Whether a domain signature verifies | The d= signing domain |
A pass does not guarantee From-domain alignment |
| DMARC | Whether SPF or DKIM passes and aligns | The visible RFC5322.From domain | Receivers retain final handling discretion |
SPF authorizes sending infrastructure. DKIM verifies a signature. DMARC connects one of those passing results to the domain recipients see and publishes reporting and handling policy.
DKIM alignment
For DMARC, DKIM is aligned when the
d=signing domain matches the visible From domain under relaxed or strict alignment rules. DKIM can pass without aligning. DMARC passes when at least one aligned mechanism passes: aligned DKIM or aligned SPF.
How to set up DKIM for your domain
You need control of your domain’s DNS and access to the service that sends your mail. Repeat the process for every platform that sends using your domain.
- Inventory every sending service and domain.
- Generate or obtain a DKIM key pair in the sending service.
- Copy the exact selector, DNS host, record type, and value supplied by the service.
- Publish the TXT record or provider-specified CNAME in DNS.
- Wait for DNS propagation, then enable or verify signing in the sending service.
- Send a real message and inspect its authentication results.
- Document the selector owner and plan for key rotation.
Create a DKIM record in Selzy
In Selzy, open your account settings and go to Domain Authentication. Add the sending domain and obtain the generated settings. Copy the host and value exactly as shown for your account: selectors and keys are specific to the domain and service.
For supporting setup details, see how to set up email authentication in Selzy.
Add the key to DNS
Sign in to the DNS provider that hosts the domain’s authoritative records. If you are unsure which provider is authoritative, a lookup service such as NsLookup can help identify the nameservers.
- Create the record type specified by the sending service, usually TXT.
- Enter the selector host, commonly in the form
selector._domainkey. - Paste the complete value beginning with
v=DKIM1. - Save the record and wait for cached DNS data to expire.
Long public keys may be displayed as multiple quoted strings by a DNS provider. That can be valid when DNS returns them as one value. Do not manually remove key characters or publish only one segment.
How to test DKIM authentication
Use more than one check because each method proves something different.
- Check DNS. Query
selector._domainkey.example.comto confirm the expected public key is visible. Tools such as MxToolbox and DKIMCore can validate record syntax. - Check the sending platform. Confirm that the domain and selector show a verified or enabled status.
- Check a real message. Send to a mailbox you control and inspect the full headers for
DKIM-SignatureandAuthentication-Results.
A DNS lookup proves that the key is published, but it does not prove that outgoing messages are being signed. A real message should normally show dkim=pass. Also confirm that the header.d domain aligns with the visible From domain when DMARC is in scope.
In Gmail, open the message menu and choose Show original. Other providers expose similar options for viewing the complete source. For more detail, see our guide to email headers.
DKIM troubleshooting
| Result or symptom | Likely cause | What to check and fix |
Key not found / dkim=none |
Wrong selector, wrong DNS host, or record not propagated | Compare the message’s d= and s= values with the live DNS name |
| Invalid or truncated key | Missing characters, extra quotes, or provider field limits | Compare the complete returned TXT value with the sender’s generated key |
| Duplicate domain suffix | The DNS interface appended the zone to a fully qualified host | Inspect the actual DNS name and remove the duplicated suffix |
| Body hash mismatch | The body changed after signing | Check forwarding, mailing-list footers, security gateways, and transport modifications |
| Signature verification failed | Wrong public key, damaged signature, or modified signed headers | Confirm selector ownership and compare a fresh test message |
| Intermittent failures | Authoritative nameservers return different records | Query every authoritative server and make their DKIM data consistent |
| DKIM passes but DMARC fails | The d= domain does not align with the visible From domain |
Configure an aligned custom signing domain with the sending provider |
| Weak or unsupported key | Old key size or algorithm incompatibility | Generate a supported 2048-bit RSA key where possible and rotate the selector |
A DKIM failure does not automatically send every message to spam. The receiver combines authentication results with DMARC policy, reputation, content, and local rules. Legitimate intermediaries can also modify a message and break a signature.
DKIM setup checklist
- Inventory every service that sends with the domain.
- Enable DKIM separately for each sender.
- Use 2048-bit keys where supported.
- Publish the exact selector host and complete public key.
- Test DNS and a real signed message.
- Confirm DKIM alignment for DMARC.
- Monitor authentication failures and DMARC reports.
- Document key owners and rotate keys periodically.
- Use DKIM together with SPF and DMARC.
DKIM is most effective as part of a maintained authentication system. Review the setup whenever you add or remove a sending platform, and keep DNS and private-key access limited to the people and services that need it.
DKIM FAQ
What is DKIM?
DKIM, or DomainKeys Identified Mail, is an email authentication standard that adds a cryptographic signature to outgoing messages. Receiving servers use the public key published in DNS to verify that the signature is valid and that the signed content was not changed in transit.
What is a DKIM record?
A DKIM record is a DNS record that contains the public key used to verify messages signed by a particular domain and selector. It is different from the DKIM-Signature header added to the email itself.
How does DKIM work?
The sender uses a private key to create a signature over selected headers and the message body. The receiver reads the domain and selector from the DKIM-Signature header, looks up the public key in DNS, and checks whether the signature and body hash are valid.
What is a selector in DKIM?
A selector is part of the DNS name used to find the correct public key for a signed message. The receiver combines the selector and signing domain from the signature to query a host such as selector1._domainkey.example.com.
Where is the DKIM public key published?
The public key is published in DNS under a selector-specific name. Receivers query that DNS record to retrieve the key needed to verify the message signature.
How is DKIM different from DMARC alignment?
DKIM authenticates that a domain is responsible for a message, but it does not by itself authenticate the visible From address. DMARC checks whether the DKIM signing domain aligns with the From domain.
What are the limits of DKIM?
DKIM can make direct domain spoofing harder, but it does not guarantee inbox placement or prove that a message is safe. Deliverability also depends on reputation, consent, engagement, list quality, and content.
Does DKIM encrypt email or protect against key changes?
No. DKIM is a signature-verification mechanism, not end-to-end encryption, and the private key does not encrypt the message or headers. The content signed by DKIM can be verified, but the standard described here does not cover key rotation details.










