DKIM selector and record mistakes that break signing
A DKIM signature fails verification for reasons that have nothing to do with the signature itself — the wrong selector, a DNS TXT record split incorrectly, or a public key too long for one record to hold are the most common causes. AdminKit explains how each breaks DKIM, and how to confirm a fix actually works.
By AdminKit team, Netbase JSC · Updated
Key takeaways
- Most DKIM failures are lookup failures. The receiver can’t find the key, or finds one that doesn’t parse, so the signature never gets a fair test.
- The record name is built from two tags in the signature:
s=(selector) andd=(domain). One typo in either and the lookup misses. - Long RSA keys must be split into 255-octet strings, and receivers join them with no spaces. A stray space, quote or cut-off breaks the key.
- RSA keys under 1024 bits are invalid under RFC 8301, and
rsa-sha1signatures are banned. - Give every new key a new selector. Reusing a selector name makes a rotation look like forgery.
Why does DKIM fail even when the key itself is correct?
RFC 6376 defines DKIM as a two-part system: a private key your mail server uses to sign outgoing messages, and a public key published in DNS that receivers fetch to verify that signature. Most real-world DKIM failures happen not because the cryptography is wrong, but because the receiver can’t find or correctly parse the published public key — a selector or DNS-formatting problem, not a signing problem. This guide is part of AdminKit’s email authentication cluster, which covers DKIM alongside the SPF and DMARC records it’s typically deployed with.
How does a receiver turn a signature into a DNS lookup?
A signed message carries a DKIM-Signature header. The receiver reads two of its tags and builds a DNS name from them, as RFC 6376 §3.6.2.1 describes: “Given a DKIM-Signature field with a ‘d=’ tag of ‘example.com’ and an ‘s=’ tag of ‘foo.bar’, the DNS query will be for ‘foo.bar._domainkey.example.com’.” Illustrated with documentation names:
DKIM-Signature: v=1; a=rsa-sha256; d=example.com; s=mail2026; ...
selector (s=) mail2026
fixed label _domainkey
signing domain (d=) example.com
TXT lookup mail2026._domainkey.example.com
Two details catch people out. Periods in a selector are label boundaries, so foo.bar is two DNS labels, not one. And the d= domain is whatever the signer put there, which isn’t always your From: domain. A sending service that signs with its own domain publishes the key under its domain, not yours, and that signature won’t align for DMARC. DMARC alignment: relaxed vs strict explained covers when that matters.
Mistake 1: what goes wrong with the selector?
The selector is the piece that tells a receiver where to look. It’s published as part of the hostname:
google._domainkey.example.com. TXT "v=DKIM1; k=rsa; p=MIGfMA0GCSq...AQAB"
A signed message’s DKIM-Signature header includes s=google; d=example.com, which a receiver combines into google._domainkey.example.com to fetch the right record. google is the default prefix selector Google Workspace suggests, and Google tells you to pick a different one if your domain already has a key under that name. Microsoft’s own documentation for configuring DKIM in Microsoft 365 shows a variant of the same mechanism in practice: Microsoft 365 assigns two selectors (selector1, selector2) and has you publish each as a CNAME record pointing back to a Microsoft-hosted key, rather than publishing the raw key yourself — still the same selector-to-hostname lookup a receiver performs, just with Microsoft managing the key material.
| Provider (per its docs) | Selector | What you publish |
|---|---|---|
| Google Workspace | google by default, or a prefix you choose | A TXT record with v=DKIM1; k=rsa; p=... |
| Microsoft 365 | selector1 and selector2 | Two CNAME records pointing at Microsoft-hosted names |
| Any other signer | Whatever the signer’s s= tag says | Whatever that provider documents |
Common ways this breaks:
- Publishing the record at the wrong hostname — a typo in the selector name, or publishing under a default selector when the provider actually signs with a different one.
- Switching mail providers without updating the selector — the old provider’s selector record is left in place (harmless but unused) while the new provider’s selector was never published at all.
- Multiple services, one selector slot filled — if two sending tools are each told to use the same selector name, only one’s key ends up published, and the other’s signatures fail verification even though that service is sending correctly-signed mail.
- The zone name entered twice. If your DNS panel adds your domain to every host name automatically, typing the full
google._domainkey.example.comcreatesgoogle._domainkey.example.com.example.com. Enter only the part before your domain, or check the saved record’s full name. - Only one of a CNAME pair published. With Microsoft 365’s two selectors, publishing
selector1but notselector2works until the first key rotation, because Microsoft’s documentation says the inactive selector is only used “after any future DKIM key rotation”.
Mistake 2: why does a truncated or split TXT record break the key?
DNS TXT records have a 255-character limit per individual string, but a DKIM public key (especially a 2048-bit RSA key) is often longer than that. RFC 8301 explains why this caused trouble for years: some “widely used DNS configuration software” only handled “a single 256-octet string in a TXT record, and RSA keys significantly longer than 1024 bits don’t fit in 256 octets.” The DNS standard allows a single TXT record to be made of multiple quoted strings that get concatenated back together, and RFC 6376 §3.6.2.2 says they “MUST be concatenated together before use with no intervening whitespace”.
A correct split, quoted from the example key in RFC 8463 Appendix A.2, followed by an illustrative broken version of the same record:
; Correct: four strings, joined with nothing between them
test._domainkey.football.example.com. IN TXT (
"v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDkHlOQoBTzWR"
"iGs5V6NpP3idY6Wk08a5qhdR6wy5bdOKb2jLQiY/J16JYi0Qvx/byYzCNb3W91y3FutAC"
"DfzwQ/BC/e/8uBsCR+yz1Lxj+PL6lHvqMKrM3rG4hstT5QjvHO9PzoxZyVYLzBfO2EeC3"
"Ip3G+2kryOTIKT+l/K4w3QIDAQAB")
; Broken: a space typed inside the second string
"iGs5V6NpP3idY6Wk08a5qhdR6wy5bdOKb2jLQiY/J16JYi0Qvx/byYzCNb3W91y3 FutAC"
Most DNS hosting providers handle this automatically when you paste a long value in, but manual zone file edits or some control panels can:
- Truncate the value at a fixed length instead of splitting it into multiple strings.
- Insert an unwanted space or line break when splitting, which changes the concatenated value.
- Drop a closing quote, leaving the record syntactically broken.
Any of these produces a public key that doesn’t match the private key actually used to sign — and from the outside, the record can look present and non-empty while still failing every verification. AdminKit’s DKIM check joins the strings the way a receiver does and reports when the result “does not look like valid base64”, which is how a stray space or quote usually shows up. To avoid the problem in the first place, the TXT record splitter splits a long value into correctly quoted 255-octet strings in your browser, and the DKIM record generator formats the full record from a public key you already have.
Mistake 3: what happens when the key length or algorithm doesn’t match?
RFC 6376 supports multiple signing algorithms (the k= tag, typically rsa); a key generated with one length or format but published or referenced with a mismatched k=/h= tag combination will fail to verify even if every other field looks correct. RFC 8301 later tightened these requirements, deprecating the weaker rsa-sha1 signing algorithm and requiring RSA keys of at least 1024 bits, which is why a very old or very short key can fail verification on a receiver that enforces the update even though it parses correctly. In its own words, signers “SHOULD use RSA keys of at least 2048 bits”, and verifiers “MUST NOT consider signatures using RSA keys of less than 1024 bits as valid”.
This is less common day-to-day than selector or truncation issues, but worth checking if a provider’s DKIM setup wizard was interrupted partway through or a key was regenerated without updating every dependent record. The valid values for the k= (key type) and h= (hash algorithm) tags are themselves fixed by IANA’s DKIM parameters registry, so a tag value outside that registry is invalid regardless of how the key itself was generated.
| Record says | Signer actually uses | Result |
|---|---|---|
k=rsa (or no k=) | An Ed25519 key | PERMFAIL, “inappropriate key algorithm” (RFC 6376 §6.1.2) |
k=ed25519 | An RSA key | The same PERMFAIL |
h=sha1 only | rsa-sha256 (the only allowed RSA algorithm) | PERMFAIL, “inappropriate hash algorithm” |
k=rsa, 512-bit key | rsa-sha256 | Invalid under RFC 8301, even though the record parses |
Ed25519 keys, added by RFC 8463, use k=ed25519 and a much shorter p= value. AdminKit’s check reports the key type it finds, but it doesn’t measure RSA key length, so check that in the tool that generated the key.
Mistake 4: why does reusing a selector for a new key cause trouble?
RFC 6376 §3.1 says it directly: “Reusing a selector with a new key … makes it impossible to tell the difference between a message that didn’t verify because the key is no longer valid and a message that is actually forged. For this reason, Signers are ill-advised to reuse selectors for new keys.” Mail is still in transit when you swap a key in place, and any message signed with the old key fails against the new record.
The same section describes the alternative: publish both keys “concurrently for the transition period”, sign with the new selector, then remove the old public key. How to rotate a DKIM key without breaking mail walks through that sequence step by step.
Mistake 5: what happens when two records sit at one selector?
RFC 6376 §3.6.2.2 says TXT records “MUST be unique for a particular selector name; that is, if there are multiple records in an RRset, the results are undefined.” This can happen when someone adds a new key at the same name instead of replacing the old one, or when two services are given the same selector. Receivers may pick either record, so verification can pass for some messages and fail for others. AdminKit’s DKIM check reports multiple records at a selector as invalid and asks you to keep exactly one.
A wildcard TXT record covering _domainkey names causes a similar problem. RFC 6376 §6.1.2 warns that it “will produce a response to a DKIM query that is unlikely to be a valid DKIM key record.” AdminKit’s check ignores TXT strings without a p= tag, so a stray wildcard shows up as “no record” rather than as a broken key.
Mistake 6: is testing mode or a revoked key hiding the problem?
Two tags in an otherwise healthy record can change what receivers do:
t=yputs the selector in testing mode. RFC 6376 §3.6.1 says verifiers “MUST NOT treat messages from Signers in testing mode differently from unsigned email, even should the signature fail to verify.” Mail signed under it gets no DKIM benefit at all. AdminKit’s check flags it.- An empty
p=means the key has been revoked. Every signature under that selector fails. That is correct for a retired selector, but on a live one it means someone revoked the key without switching signing to a new selector.
How do you test a fix?
- Confirm which selector your provider actually uses — check the sending service’s own DKIM setup page or the
s=tag in aDKIM-Signatureheader from a real sent message (visible in most email clients’ “show original” or “view source” option). - Look up the record directly with AdminKit’s DKIM check, entering your domain and that exact selector — it reads the TXT record from DNS and reports whether it parses as a valid DKIM key.
- Cross-check with a raw DNS lookup using DNS lookup against
<selector>._domainkey.<yourdomain>if you want to see the raw TXT value as published, which helps spot a truncation or formatting issue the parsed check might summarize away. - Send a real test message once the record checks out, and inspect its headers for
dkim=passfrom the receiving server, as a final confirmation that signing and publishing now agree.
| What you see | Most likely mistake | Where to look |
|---|---|---|
| No record at the selector | Wrong selector, wrong domain, or zone name doubled | The s= and d= tags of a real message |
| “Does not look like valid base64” | A space, quote or line break inside the key | The raw TXT value in a DNS lookup |
p= empty | Revoked key on a selector still in use | Your provider’s DKIM settings |
| Multiple records | Old and new key at the same name | Remove one; use a new selector next time |
| Record looks fine, mail still fails | Short key, algorithm mismatch, or signer using another selector | The key generator, and Authentication-Results |
If you’re setting up SPF, DKIM, and DMARC together for the first time rather than debugging an existing setup, see SPF, DKIM and DMARC explained for how the three fit together before troubleshooting one in isolation. For a field-by-field reading of the check’s output, see how to read a DKIM check result.
This guide is general information, not a security audit of your specific network — see our disclaimer for what AdminKit's guidance does and does not commit to.
Frequently asked questions
What exactly is a DKIM selector, and where does it come from?
A selector is a short label your mail provider chooses, used to build the DNS hostname where the public key is published: selector._domainkey.example.com. You don't invent it — your mail provider (Google Workspace, Microsoft 365, Mailgun, SendGrid, and so on) assigns it and tells you which TXT record to publish.
Why does a receiving server even need the selector?
The signing server includes the selector and signing domain in the message's DKIM-Signature header (the s= and d= tags). A receiver reads those two values to know exactly which DNS record to fetch and verify against — get the published record wrong, or publish it at the wrong hostname, and verification fails even though the signature itself might be mathematically correct.
My TXT record looks right in the DNS zone file — why does the check still fail?
Most DNS providers split long TXT record values into multiple quoted strings automatically, but some manual zone editors or copy-paste from a provider's dashboard can introduce an extra line break, stray quote, or truncate the value at a fixed character limit — all of which produce a public key that doesn't match the one actually used to sign, even though the record 'looks' present.
Can I use more than one DKIM selector at the same time?
Yes, and it's normal — a domain using two sending services (say, Google Workspace for staff mail and SendGrid for transactional mail) typically has two different selectors, each with its own TXT record, because each service signs with its own key under its own selector name.
How do I test a DKIM fix without waiting for a real email to fail?
AdminKit's DKIM check reads the published TXT record directly from DNS for a given domain and selector, so you can confirm the record resolves and parses correctly immediately after publishing a fix, without needing to send and inspect a real test message.
Can I publish a new key under the same selector name?
You can, but RFC 6376 §3.1 advises against it: reusing a selector with a new key makes it impossible to tell a message that failed because the key changed from one that is actually forged. Publish the new key under a new selector, switch signing to it, and retire the old selector once mail signed with it has been delivered.
Sources
- RFC 6376 — DomainKeys Identified Mail (DKIM) Signatures
- RFC 8301 — Cryptographic Algorithm and Key Usage Update to DKIM
- IANA — DKIM-Signature Tag Specifications (dkim-parameters registry)
- Microsoft Learn — Use DKIM to validate outbound email sent from your custom domain (Microsoft 365)
- Google Workspace Admin Help — Set up DKIM (default prefix selector and key length)
- RFC 8463 — A New Cryptographic Signature Method for DKIM (Ed25519)
Related tools
Want AdminKit to watch this for you?
Free checks tell you the state today. Protective DNS and monitoring tell you when it changes.
Talk to an expert
Huy Nguyen (David), Founder & CEO, Netbase JSC
Ask whether this fix applies to your setup, or get a second pair of eyes on your DNS and mail records.