DKIM fail: the 7 causes and how to fix each one

Diagram of a DKIM fail with the reason shown in the message header

A DKIM fail means the message carried a signature and the receiving server could not verify it. Either the public key was not found in DNS, or the message changed after it was signed, or the key and the signature no longer match. The header names which one in a short reason in brackets, and that reason tells you which of 7 causes to repair.

A failed signature is not the same as a missing one, and the two are fixed in different places. This guide shows how to read the reason, find the cause, and confirm the repair.

What does a DKIM fail mean?

The result means a signature was present and did not pass verification. The receiver found the DKIM-Signature header, tried to check it against the public key in your DNS, and the check came back negative.

DKIM, short for DomainKeys Identified Mail, is defined in RFC 6376. The sending server signs each message with a private key, and the receiver fetches the matching public key from a DNS record named by the DKIM selector. The selector is the label in the s= tag of the signature.

Receivers record the outcome in the Authentication-Results header. RFC 8601 defines 7 possible results:

Result Meaning in RFC 8601
none The message was not signed
pass The message was signed and the signature passed verification
fail The message was signed, but the signature failed the verification test
policy Signed, but some aspect of the signature was not acceptable to the receiver
neutral Signed, but the signature had syntax errors or could not be processed
temperror A transient error, such as a temporary inability to retrieve the public key
permerror An unrecoverable error, such as a required header field being absent

RFC 6376 tells receivers to treat a message with a bad signature no differently from a message with no signature at all. On its own that sounds harmless. In practice the message has lost one of its two routes to passing DMARC, and bulk senders are required to authenticate.

How do you read the reason in the header?

Open a delivered copy of the message, view the original, and find the line that starts with dkim= in the Authentication-Results header. The reason sits in brackets after the result.

Microsoft 365 writes it like this, per its message headers reference:

Authentication-Results: spf=pass smtp.mailfrom=example.com;
  dkim=fail (body hash did not verify) header.d=example.com;
  dmarc=pass action=none header.from=example.com

The reasons are not free text. RFC 6376 section 6.1 gives the exact strings a verifier returns, and most receivers reuse them:

Reason in the header What the verifier found Cause
no key for signature No public key at the selector the signature names 1
key syntax error A record exists, but it cannot be parsed 2
body hash did not verify The body changed after signing 3
signature did not verify The signed headers changed, or the key is not the right one 4
key revoked The record is there with an empty p= value 5
signature expired The x= time in the signature has passed 6
inappropriate hash algorithm, or a note about key length The algorithm or key size is one the receiver will not accept 7

Write down three values from the DKIM-Signature header before you go further: the signing domain in d=, the selector in s=, and the algorithm in a=. Every repair below starts from those.

What are the 7 causes, and which one do you have?

Each cause leaves a different reason in the header, so one failing message is enough to tell them apart. Match the reason from the table above to the row below.

# Cause Where it is fixed
1 The DKIM record is missing, or published under the wrong name DNS
2 The key was truncated or broken when it was pasted into DNS DNS
3 Something rewrote the message body after signing The gateway, footer tool or forwarder
4 The headers were rewritten, or the keys do not match The sending platform
5 The key was rotated or revoked while mail still used it DNS and the sending platform
6 The signature expired before delivery The sending platform
7 The key is too short or the algorithm is retired The sending platform

Causes 1 and 3 are the ones to check first. A new sending tool whose records were never published produces cause 1, and a gateway that stamps a disclaimer onto outgoing mail produces cause 3.

One case looks like a failure and is not. If the header shows dkim=pass for the platform's own domain and DMARC still fails, the signature is fine and the domain is wrong. That is an alignment problem, covered in our guide to a DMARC fail.

How do you fix each cause?

Fix the cause the reason names, send a new test message, and read the header again. Old messages keep their old result, so always test with fresh mail.

Cause 1: publish the record at the right name

Look up the selector from the failing message. With s=k2 and d=example.com, the record lives at k2._domainkey.example.com:

$ dig +short TXT k2._domainkey.example.com
"v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAu1SU1LfVLPHCozMxH2Mo..."

An empty answer means the record is not there. The usual reasons are a selector that differs from the one the platform signs with, a record created on the wrong domain, or a DNS panel that appended the domain twice and produced k2._domainkey.example.com.example.com. The DKIM checker runs the same lookup for any selector.

Microsoft 365 uses two CNAME records in place of a TXT record, named selector1._domainkey and selector2._domainkey. As of November 25, 2026, Microsoft's DKIM setup page says to always create both, and that DNS propagation can take a few minutes to 48 hours.

Cause 2: repair a truncated key

A 2048-bit public key is longer than one DNS text string can hold. Google's DKIM troubleshooting page notes that most TXT records hold up to 255 characters in a single string, so a long key that is pasted as one string can be cut short.

The key has to be split into several quoted strings inside one record. Receivers join them back together:

k2._domainkey.example.com.  TXT  ( "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAu1SU1LfVLPHCozMxH2Mo"
                                   "4lgOEePzNm0tRgeLezV6ffAt0gunVTLw7onLRnrq0/IzW7yWR7QkrmBL7jTKEn5u"
                                   "+qKhbwKfBstIs+bMY2Zkp18gnTxKLxoS2tFczGkPLPgizskuemMghRniWaoLcyeh" )

Many DNS panels do the split for you. Compare the published value with the key in the platform character by character, and look for a missing tail, an added space or a stray line break.

Cause 3: stop the body from changing after signing

The reason "body hash did not verify" means the body the receiver hashed is not the body that was signed. Google's troubleshooting page says this text shows the message was modified in transit.

Three things do this. An outbound gateway adds a footer or disclaimer, a security tool rewrites links, or a mailing list appends its own text. Google's page states that gateways should not modify outgoing mail before sending.

The repair is to sign last. Move the DKIM signing step to the final system that touches the message, or switch off the feature that edits it. Then check the canonicalization setting, which decides how much change a signature tolerates:

c= value What it tolerates
simple Almost no modification. The default when the tag is absent
relaxed Common changes such as whitespace replacement and header line rewrapping

Set c=relaxed/relaxed where the platform allows it. It survives the small whitespace changes that mail servers make in transit, and it does not survive an added footer. Do not use the l= body length tag as a workaround. Google's page advises against it and cites section 8.2 of RFC 6376.

Cause 4: fix a key mismatch or rewritten headers

When the reason is "signature did not verify", the body is intact and the signature over the headers is not. Either a signed header such as Subject or From was changed after signing, or the public key in DNS does not belong to the private key in use.

Check the key first. If the platform shows a different public key from the one in DNS, publish the current one. If the keys match, look for a system that rewrites the subject line or the From address after the signature is added.

Cause 5: finish the key rotation

A record with an empty p= value is a revoked key under RFC 6376, and every signature that still points to it fails. This happens when the old record is cleared before the platform has switched to the new selector.

Keep the old public key published until no mail signed with it is still in transit. As of November 25, 2026, Microsoft's DKIM setup page says a key rotation is not immediate and takes four days (96 hours) to take effect, so mail keeps using the old key for that long.

Cause 6: lengthen or remove the expiry

The x= tag sets a time after which the signature may be treated as invalid. A short window combined with delayed delivery, such as a message held in a queue or retried for a day, produces an expired signature.

Raise the window to several days or remove the tag in the platform's signing settings.

Cause 7: move to a current key and algorithm

RFC 8301 retired the old settings. It says rsa-sha1 must not be used for signing or verifying, that signers must use RSA keys of at least 1024 bits and should use at least 2048 bits, and that verifiers must not accept keys shorter than 1024 bits.

Generate a 2048-bit key and sign with rsa-sha256. In Microsoft 365 the default key size is 1024 bits, and this command moves the domain to 2048 at the next rotation:

Rotate-DkimSigningConfig -Identity example.com -KeySize 2048

What do Gmail, Yahoo and Microsoft do with a failed signature?

All three record the result in the header, and Gmail can also refuse the message outright. As of November 25, 2026, Gmail's SMTP error reference lists a rejection and a temporary refusal for it, and states that Gmail requires bulk email senders to authenticate their email with DKIM.

550 5.7.30 This message was blocked because it didn't pass DKIM authentication.
421 4.7.30 Your email has been rate limited because DKIM authentication didn't pass for this message.

Gmail also has a limit that surprises senders with many signatures. Google's troubleshooting page says Gmail checks only the first 5 signatures on a message, and if the one that would pass is not among them, the message fails.

Microsoft 365 folds the result into a combined verdict called composite authentication, shown as compauth in the header. When the result also causes a DMARC failure on a domain with a policy of reject, Microsoft's list of non-delivery reports gives the bounce as code 5.7.509.

Yahoo's SMTP error codes page has a section on authentication failures and says a 5xx error should not be retried. None of the three publishes a promise in the other direction: a passing signature does not decide where a message is placed.

How do we diagnose it on a client domain?

We start from the DMARC aggregate reports, because they show the DKIM result for every sending source at once. A single header shows one tool, and a domain usually has several.

The order we work in:

  1. We pull 2 weeks of aggregate reports and list each source with its DKIM result and signing domain.
  2. We check every selector in use against DNS, including selectors for tools the business forgot it had.
  3. We pull one failing header per source and read the reason in brackets.
  4. We send a test through each path the mail can take. A message sent from the platform directly may pass while the same message sent through the company gateway fails.
  5. We repair one source at a time and confirm it in the next day's reports.

Step 4 matters because the routes can differ. A signature that passes on one route and fails on another points to a system in the middle that edits the message, which is cause 3.

On one engagement in our case studies, the authentication pass rate measured 71% before the work and 98.5% after it. That work began with an audit of the business domains and every active sending service, the same first two steps as above.

If you do not know which selectors your domain uses, start with the free email deliverability test. It reads the SPF, DKIM and DMARC records for the domain in one pass. For how the three records work together, see our guide to SPF, DKIM and DMARC.

When is a failure nothing to fix?

Three cases need no repair on your side: a transient lookup error, a message that a mailing list rewrote, and mail that someone else forged. Each one shows in the reports and none of them points to a fault in your setup.

A temperror result means the receiver could not fetch the key at that moment. RFC 8601 says a later attempt may produce a final result. If it repeats for days, check that your DNS host answers reliably.

Mailing lists that add a subject tag or a footer break the signature by design. You cannot repair that from the sending side, and a small share of list mail will always show as failing.

Forged mail with a made-up signature fails because the forger does not hold your private key. That is DKIM working as intended. A key published with t=y is a related case: RFC 6376 says the domain is testing DKIM, and receivers must not treat that mail differently from unsigned mail. Remove the flag once testing is over.

Drafted with AI assistance from our own records and client work, then reviewed and approved by Kunal Arora. See our editorial policy.