What Is DKIM and How Does It Help Verify Email?
DKIM adds a digital signature to every outgoing message so receivers can check it was not altered and that your domain approved it. Learn how it works and how to set it up.
10 min readUpdated Nov 22, 2026By XPASS Editorial Team

When you receive a letter on paper, a wax seal or signature tells you who stood behind it. Email has a similar tool called DKIM, short for DomainKeys Identified Mail. It lets a sending system attach a digital signature to each message, so that the receiving system can check two things: that the message really passed through a system authorized by a given domain, and that important parts of it were not changed on the way.
This guide explains DKIM in plain language. You will see how signing and verification work, what a selector is, how to publish the key in DNS, how to test your setup, and what DKIM cannot do on its own.
What DKIM does
DKIM is defined in RFC 6376. The sending server, or a service acting for it, creates a signature over selected headers and the body of the message. It adds that signature to the message in a header called DKIM-Signature. The receiving server reads the header, finds out which domain and selector signed it, looks up the matching public key in DNS, and verifies the signature.
If the verification works, the receiver knows two things.
- Integrity. The signed parts of the message were not altered after signing. If someone changed the body or a signed header on the way, the signature check fails.
- Domain responsibility. The domain named in the signature, called the d= domain, had access to the private key that produced it. That domain took responsibility for sending the message.
DKIM does not encrypt the message, and it does not hide the content from anyone who handles it. It is a signature, not a lock.

Keys, selectors and the DNS record
DKIM uses a pair of keys. The private key stays on the sending system and creates signatures. The public key is published in DNS so anyone can verify them.
The public key is stored in a TXT record at a special name:
selector1._domainkey.example.com
The first part, selector1, is the selector. It is a label chosen by you or your provider. The _domainkey part is a fixed word, and example.com is your domain. A selector lets one domain publish several keys at the same time, for example one per mail service, or an old and a new key during rotation.
The record content looks like this, with the key shortened for illustration.
v=DKIM1; k=rsa; p=MIIBIjANBgkqh...
v=DKIM1is the record version.k=rsais the key type. RSA is common, and newer systems may also support Ed25519.p=holds the public key in base64. If the key is revoked, the p= value is left empty.
Some providers ask you to publish a CNAME record that points the selector name to a record on their own domain instead of a TXT record. This lets the provider rotate keys on your behalf. Follow exactly what the provider shows you.
Key size
Many providers use 2048-bit RSA keys today, as 1024-bit keys are considered weak for long-term use. A 2048-bit key may exceed the length of a single DNS string, so some DNS interfaces split it into several quoted pieces automatically. If you manage records by hand, use your provider's guidance for that detail.
How verification works step by step
- Your system composes a message and creates a hash of the body and chosen headers.
- It signs the hash with the private key and adds a DKIM-Signature header that names the d= domain, the selector (s=), the signed header list (h=) and the signature itself.
- The message travels across the internet.
- The receiver reads the DKIM-Signature header and queries DNS for the TXT record at selector._domainkey.d-domain.
- It recomputes the hash from the received message and checks it against the signature using the public key.
- If they match, the result is dkim=pass. If not, the result is dkim=fail, or an error if the key cannot be found.
Two optional settings affect how forgiving verification is. Header and body canonicalization can be relaxed or simple, and relaxed mode ignores small harmless changes such as extra whitespace. Most providers use relaxed canonicalization for exactly this reason.
Setting up DKIM step by step
Step 1: Decide which systems must sign
Every service that sends mail with your domain in the From line should sign, ideally using your own domain. That includes your mailbox provider, your newsletter or marketing tool, your invoicing platform and your website's mail sender.
Step 2: Turn on DKIM in each service
In most providers, DKIM is a setting in the domain or email authentication section. The provider generates the key pair and shows you the DNS record to publish. Choose a key size of 2048 bits if you are given the option.
Step 3: Publish the record in DNS
Copy the record name and value exactly as shown. Some DNS panels already append your domain, so you might enter only selector1._domainkey for the name. Check the panel's help text so you do not end up with the domain written twice.
Step 4: Wait for DNS and confirm
After DNS changes spread, use the provider's verification button, or an online DKIM checker, to confirm the key can be found. Do not enable signing until the record is visible, otherwise receivers cannot validate your mail.
Step 5: Send test messages and read headers
Send a message to a mailbox at a different provider. Open the full headers and look for Authentication-Results. You want to see dkim=pass along with the domain in header.d=. Make sure that the d= domain is your own domain, not only the provider's domain.
Step 6: Plan rotation
Keys should be rotated from time to time. A common approach is to publish a new selector, switch the signing system to it, wait until old mail has been delivered, and then retire the old selector. Many hosted services do this for you.
A plain example
A small bakery uses example.com for its website and email. Staff mail is hosted by a mailbox provider, and a newsletter tool sends weekly offers.
The owner turns on DKIM in the mailbox provider, which asks for one CNAME record at selector1._domainkey. She publishes it and tests by sending a message to a different mailbox provider. The headers show dkim=pass header.d=example.com.
She then sets up the newsletter tool. At first the tool signs with its own domain, so the header shows dkim=pass header.d=newsletter-tool.example. That passes DKIM, but the d= domain does not match the bakery's From domain, so it will not help with DMARC. She finds the tool's custom domain authentication setting, publishes the two records it requests, and the next test shows header.d=example.com. Now the newsletter signature belongs to the bakery's domain. Our guide to how SPF, DKIM and DMARC differ explains why this alignment matters.
Limits and what to watch for
DKIM is a strong building block, but it has limits you should know.
- A signature is not a judgment of quality. Spammers can sign mail too, using their own domains. A pass shows who signed, not whether the mail is wanted.
- Alignment is separate. DKIM only says the d= domain signed the message. It is DMARC that checks whether that domain matches the visible From domain. See what DMARC is and why businesses need it.
- Only signed parts are protected. If a header is not in the signed list, it can be changed without breaking the signature. Providers normally sign From, Subject, Date and other key headers.
- Mailing lists and gateways can break it. A system that adds a footer or edits the subject changes signed content and breaks the signature. Some systems re-sign mail afterward.
- Keys must be protected. If a private key leaks, others can sign as your domain. Rotate keys and restrict access.
- Replay is possible. A valid signed message can be re-sent by someone else. The signature does not prove who the intended recipient was.
- Missing keys cause failures. If you delete a selector record while mail is still signed with it, verification fails.
- It does not replace SPF. SPF checks the sending server, DKIM checks the message. Use both, as described in setting up SPF.
Common mistakes
- Publishing the record under the wrong name, such as forgetting
_domainkey, or duplicating the domain name. - Copying the key with a line break, extra space or missing character, which makes the key invalid.
- Turning on signing before the DNS record is live.
- Leaving a service signing with the provider's default domain, so the d= domain never matches your From domain.
- Deleting an old selector too soon after rotating.
- Forgetting a sender such as a billing or helpdesk tool.
- Assuming a pass in one test message means every service is set up.
Where DKIM fits in a business setup
For a company, the practical goal is that every legitimate message is signed with the company's own domain, and that the signature passes consistently. A hosted business email service often sets up DKIM for its own mail, but any extra tools that send on your behalf need to be set up separately. If you want to monitor authentication results and filter incoming threats too, look at how an email security service handles both directions.
Reading a DKIM-Signature header
It helps to recognize the main fields in a signature header when you troubleshoot. The v=1 tag is the version. The a= tag names the signing algorithm, for example rsa-sha256. The d= tag is the signing domain and the s= tag is the selector, so together they tell the receiver where to look in DNS. The h= tag lists the headers that were signed, bh= is the hash of the body, and b= is the signature itself. The c= tag shows the canonicalization mode, such as relaxed/relaxed.
When a check fails, compare these values with what you expect. A wrong selector in s= points to a missing DNS record. A d= value that is not your domain points to a sender that is still using its default signing. A failure that appears only on mail passing through a mailing list or a security gateway often means that something changed the body or a signed header on the way.
What DKIM means for deliverability
Mailbox providers look at many signals when deciding where to place a message, and an authenticated sending domain is one positive signal among them. A consistent DKIM signature from your own domain lets receivers build a reputation for that domain over time, instead of judging each message in isolation or relying only on the reputation of a shared provider. This does not promise inbox placement, because content, recipient engagement and complaint rates all matter, but it removes one common reason for mail to be treated with suspicion.
Summary
DKIM adds a digital signature to outgoing mail, using a private key held by the sender and a public key published in DNS under a selector. Receivers use it to check that signed parts of a message were not altered and that the signing domain took responsibility for it. To set it up, enable DKIM in every sending service, publish the record exactly as given, wait for DNS, test with real messages and confirm the d= domain is yours, and plan to rotate keys. Remember that DKIM proves who signed, not that mail is wanted, and that DMARC is what ties the signature to the visible From address. If you want to explore services that help manage this, the business email page is a good place to look.
Frequently asked questions
What does DKIM do?
DKIM adds a cryptographic signature to outgoing mail. The receiving server looks up the public key in DNS and checks that the signed parts of the message were not changed and that the signing domain authorized the message.
What is a DKIM selector?
A selector is a label that tells receivers which public key to fetch. The key is published at selector._domainkey.yourdomain. Selectors let a domain have several keys at once, for different services or for key rotation.
Does a valid DKIM signature prove the email is trustworthy?
No. It shows that the signing domain took responsibility for the message and that it was not altered in transit. A legitimate service can still be abused, and a signing domain may differ from the visible From domain unless DMARC alignment is checked.
Where do I find the DKIM record for my domain?
Your mail or sending provider generates the key pair and shows you the DNS record to publish, usually a TXT or CNAME record under a selector name. Copy it exactly into your DNS settings.
References
About the author

Bob Kanokphon Thongdee
- Founder of XPASS VPN
- Co-founder of eSIMonline.asia
- More than 7 years in online marketing
- Founder of Cojourney Visa and Cojourney Travel
Protect your email and stop spoofing
Spam filtering and DMARC monitoring for your domain.
See email securityKeep reading

Business Email Guides
What Is SPF and How Do You Set It Up?
SPF is a DNS record that lists which servers may send email for your domain. Learn how to write it, test it and avoid the mistakes that break it.
10 min read

Business Email Guides
SPF, DKIM and DMARC: What Is the Difference?
SPF checks the sending server, DKIM checks a signature, and DMARC ties both to the From address and sets a policy. See how the three fit together and what to set up first.
9 min read

Business Email Guides
What Is DMARC and Why Every Business Should Know It
DMARC tells receiving mail servers what to do when a message claiming to be from your domain fails authentication. Learn how it works and how to roll it out step by step.
10 min read