Guides DKIM
What is DKIM?
Your mail provider can digitally sign messages for your domain. Check the signature at the receiving end and plan a safe changeover when replacing keys.
Before sending a message for example.com, your mail provider adds a digital signature. The receiver can use it to detect changes to the signed parts. It checks the signature using information you publish at example.com. This is DKIM.
One signed message from example.com
Your mail provider signs a message for example.com before sending it. This uses two related keys. The provider keeps one secret and uses it to sign. The other is public and lets receivers check the signature. These are called the private key and public key.
The public key is published with example.com in the domain settings, known as DNS. The receiver retrieves it there and checks the message. If the check succeeds, the signature matches example.com and the message parts covered by that signature. That successful result is called a DKIM pass.
The signature links the message to a domain. It does not tell you who wrote the mail or what their intentions are, and it does not encrypt the mail.
How the receiver finds the right key
A domain can have more than one public key, for example because several services send mail or a key is being replaced. The receiver therefore needs to know which key belongs to this message. Your sending service puts the domain name and a key name in the message's technical headers. That key name is called the selector.
In the DKIM-Signature header, d= holds the domain and s= holds the selector. For d=example.com; s=mail2026, the DNS name is mail2026._domainkey.example.com. Its general form is <selector>._domainkey.<domain>. The receiver uses that name to find the public key.
You usually do not have to invent selectors. Your provider supplies the name and value. You can also find them in the original headers of a message actually sent.
What's in DNS?
Your provider supplies a text record containing the public key, or a reference to a key it manages itself. In DNS, a text record is called TXT and such a reference is called CNAME.
The public key is a TXT record at <selector>._domainkey.<domain>. The domain comes from d= and the selector from s=. The main parts are:
v=DKIM1: the versionk=rsaork=ed25519: the key typep=...: the public key. Use the provider's complete value- an empty
p=: the key has been revoked
Many providers ask you to publish a CNAME instead. For example: mail2026._domainkey.example.com CNAME key.provider.example.net.. Copy the actual name and value from your provider account. Do not also add a TXT record at that same name.
Each selector should have one key record. A long TXT value can contain several text fragments within that single record. The receiver joins them without adding spaces. This differs from two separate TXT records containing different keys.
Setting up and checking DKIM
- Ask each sending service to enable DKIM for the domain you want to sign with
- Copy the supplied TXT or CNAME name and value exactly into DNS. Check whether the DNS panel appends the domain
- Have the provider verify publication and enable signing if that is a separate step
- Send a test message from each service to a mailbox you control
- View the original headers: read
d=ands=in DKIM-Signature and the result added by your receiving mail server
For d=example.com; s=mail2026, the DNS name is mail2026._domainkey.example.com. In a panel for example.com, Name/Host is often just mail2026._domainkey. Check the full name after saving. A usable key in DNS does not prove the service signs with it. In the received message, look for a result such as dkim=pass header.d=example.com header.s=mail2026 and also note the visible sender domain.
DNS cannot give you a complete list of selectors. Checkers try known names. Finding nothing does not prove you use no DKIM. Get the selector from your provider account or a message actually sent. DNS Radar's Mailheaders tool extracts it from pasted headers, but does not verify the signature again or prove who wrote those headers.
If a test fails, check the selector and d= domain used, the DNS name and value, and whether the provider enabled signing. Then investigate whether an intermediate service changes the covered content. Do not add a second key record by guesswork.
What a signature does and does not tell you
For the signature, the server calculates a check value, like a fingerprint of the selected message parts. The server signs selected headers and the covered message content. Not every header is automatically covered. Certain formatting differences may be allowed, and a signature can cover only part of the body. A pass therefore does not mean every byte remained unchanged in transit.
The provider can sign for example.com, as above, or under its own domain. For example, the visible address is info@example.com, but the signature says d=provider.example.net. That signature can be valid without confirming the visible sender domain.
DMARC checks that link. The receiver checks whether the domain for which a signature check or server check passes matches the visible sender domain. SPF checks whether the sending server is allowed to send for a domain. DMARC needs only one of these checks to pass for a domain that matches the visible sender. Where possible, use a signing domain of your own that meets that requirement for every sending service. See the DMARC guide for more detail.
A signature can remain valid during forwarding if the covered parts stay intact. The SPF check can fail because a different server offers the mail. A mailing list that changes the subject or body can instead break the signature. Correctly signed mail can still be harmful. These checks do not assess its content.
Choosing keys and algorithms
Providers can offer different kinds of keys. RSA is a common type. Its length in bits is one of the characteristics used to assess strength.
Choose at least 2048 bits for new RSA keys. For an existing key, distinguish the protocol limit from the recommendation:
- Below 1024 bits: a conforming receiver must not accept the RSA signature as valid
- From 1024 to below 2048 bits: meets the protocol minimum but is weaker than recommended. Plan replacement
- At least 2048 bits: meets the recommended minimum RSA length. This alone does not prove safe key storage or a valid signature
For RSA, the server must sign with rsa-sha256. rsa-sha1 is no longer allowed. Ed25519 is a more compact alternative. Agree the choice and compatibility requirements with your provider.
To use RSA and Ed25519 alongside each other, use separate selectors, such as rsa2026 and ed2026. The server must actually add two signatures with the corresponding algorithms and selectors. Publishing two keys alone does not do this. Do not put two key records under one selector.
Rotating keys and recovering safely
Plan key changes with your provider. A CNAME can delegate management, but does not prove the provider rotates keys automatically. Agree who makes changes, who receives error alerts and how you check the result. DKIM sets no universal rotation interval of six or twelve months.
- Publish the new public key under a new selector
- Check that it is available and allow for DNS processing and previously cached answers before signing with it
- Switch the sender to the new selector and test the received mail
- Keep the old public key available for a reasonable validation period for delayed old messages. Then remove it in agreement with the provider
A leaked private key calls for a different decision from planned maintenance. Have the provider replace and revoke it promptly, for example with an empty p=. This can cause old signatures to fail. DNS caches do not disappear immediately. Receivers with a cached answer may still accept the old key.
Primary sources
Frequently asked questions
What is a DKIM selector?
The receiver needs to know which public key belongs to a message. The key name used to find it is called the selector. A domain can have several selectors, for example per provider or key change. The selector and domain together determine the DNS name <selector>._domainkey.<domain>.
Why can't a checker find my DKIM?
A checker cannot ask DNS to list every possible key name. It tries known names, called selectors. If yours is not among them, DKIM may still work. Get the selector from your provider account or a message actually sent and supply it to the checker. Pasted headers are not independent proof that the signature was valid.
What key length should I use?
Choose at least 2048 bits for new RSA keys. 1024 bits remains the protocol minimum but is below the recommendation. Below 1024 bits, a conforming receiver must not accept the signature. Ed25519 is an alternative. Agree support and any dual signing with your provider.
How often should I rotate my DKIM key?
Agree a schedule with your provider based on key management and risk. A CNAME does not automatically mean keys are rotated for you. For a planned change, use a new selector and an overlap period so delayed messages can still be checked with the old public key.
What does an empty p= mean?
That the key has been revoked. A record with p= and no value tells receivers this selector is no longer valid.