Skip to content
  • There are no suggestions because the search field is empty.

What is DKIM and how it works

DKIM, short for DomainKeys Identified Mail, means a domain signs its outgoing email with a private key, and the receiving server checks that signature against a public key published in the domain's DNS. If the signature verifies, the receiver knows two things: the signing domain (the d= domain) takes responsibility for the message, and the parts of the message that were signed haven't changed since signing. That's all a pass proves. It doesn't prove the visible From address is genuine, that the message is safe, or that it'll reach the inbox. Connecting DKIM to the From address is DMARC's job.

What DKIM is for

DKIM is a way for a domain to claim some responsibility for a message by signing it. There's no certificate authority involved. The public key lives in DNS, and anyone receiving the mail can fetch it.

A useful way to think about it: DKIM gives the receiver a verified domain name it can attach reputation to. SPF does something similar for the bounce address (Envelope From vs Header From explains the difference), and DMARC ties the results back to the address people see. For how all three fit together, see What is email authentication?.

What's in a DKIM signature?

Your sending system holds the private key. That might be your own mail server, Google Workspace, Microsoft 365, or a marketing platform. For each message it signs, it adds a DKIM-Signature: header. A trimmed example:

DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
  d=example.com; s=mail2026;
  h=from:to:subject:date:message-id;
  bh=<hash of the body>;
  b=<the signature itself>

The tags that matter most:

  • d= is the signing domain. This is the identity DKIM authenticates.
  • s= is the selector. It tells the receiver which key to fetch (DKIM selectors and DNS records).
  • h= lists the header fields that were signed. The From header must always be one of them. Subject, Date, To, and Reply-To are common choices. Headers that aren't listed aren't protected.
  • bh= is a hash of the message body.
  • b= is the signature over the signed headers.
  • c= is the canonicalization, explained below.
  • a= is the algorithm. Signers must use rsa-sha256; rsa-sha1 must not be used. A newer Ed25519 method also exists; key choices are covered in 1024-bit vs 2048-bit DKIM keys.

Where the public key lives

The receiver builds a DNS name from the selector and the signing domain: <selector>._domainkey.<d= domain>. For the example above, that's the name below. The key is shortened here; don't publish this sample:

mail2026._domainkey.example.com  TXT  "v=DKIM1; k=rsa; p=MIIBIjANBgkqh..."

That TXT record is what people mean by a DKIM record. Some providers have you publish a CNAME instead, pointing to a key they host. Microsoft 365, for example, uses selector1._domainkey and selector2._domainkey CNAMEs. Record formats, selectors, and setup steps are in DKIM selectors and DNS records.

How does DKIM work?

Here's DKIM verification, simplified:

  1. Fetch the key. The receiver reads d= and s= from the signature and looks up the public key in DNS.
  2. Check the body. It recomputes the body hash the way c= says and compares it with bh=. If they differ, the result is "body hash did not verify": the body changed after signing.
  3. Check the signature. It verifies b= over the signed headers with the public key. If that fails, the result is "signature did not verify".
  4. Record the result. If both checks match, the signature verifies, and the d= domain becomes the authenticated identity.

Receivers usually record the outcome in an Authentication-Results header with a value such as pass, fail, none (not signed), neutral, policy, temperror, or permerror. Causes behind each failure are in Why DKIM signatures fail.

What canonicalization changes

Canonicalization decides how strictly "unchanged" is judged. simple tolerates almost no change. relaxed tolerates common harmless changes such as whitespace and re-wrapped headers. Header and body can use different modes, and the default when c= is absent is simple/simple. So "not altered" really means "not altered beyond what the chosen canonicalization ignores."

What a DKIM pass does and doesn't prove

A pass proves the signed headers and body are unchanged since signing, and that the d= domain signed them. Verification asserts that the hashed content has not changed since it was signed, and asserts nothing else.

It doesn't prove:

  • The From address. The signing domain isn't required to match any visible address, including the MAIL FROM or From addresses.
  • That the mail is wanted. Anyone can sign with a domain they control. A message can bear a valid signature from any domain, even one used by a bad actor.
  • Inbox placement. Google's DKIM troubleshooting page says that if DKIM is set up correctly but messages go to spam, "the cause might be something other than DKIM."
  • Privacy. DKIM doesn't encrypt anything.

And a failed signature doesn't, by itself, get mail rejected. A failure does not force rejection, and verifiers should treat an unverifiable signature the same as unverified email. What happens next depends on the receiver's own filtering and, if you publish one, your DMARC policy.

How DKIM connects to DMARC

DMARC can count a DKIM pass only when the d= domain is aligned with the domain in the From header. Under relaxed alignment, the two need to share the same organizational domain, so d=mail.example.com aligns with From: news@example.com. Under strict alignment, they must be identical. The adkim tag in your DMARC record picks the mode (Identifier alignment for SPF and DKIM).

A message can carry several signatures. A common case is one from the platform's own domain and one from yours. DMARC needs just one valid, aligned signature. Gmail, though, only checks the first five signatures listed in Authentication-Results.

Aligned DKIM matters more than SPF in one situation: forwarding. A plain forward changes the sending server, which usually breaks SPF, but DKIM signatures will generally remain valid in these relay situations as long as the message isn't modified. Domains that publish p=reject must not rely on SPF alone and must apply valid DKIM signatures. Mailing lists are a different story (DKIM and mailing lists or forwarders).

For the DMARC side of the picture, see What is DMARC and how it works.

What mailbox providers ask for

Gmail requires SPF or DKIM for everyone sending to Gmail accounts, and both SPF and DKIM for senders of more than 5,000 messages a day to Gmail accounts. Sending to personal Gmail accounts needs a DKIM key of 1024 bits or longer, and Google recommends 2048 bits if your DNS provider supports it. Yahoo asks senders to authenticate every email with DKIM, with a minimum 1024-bit key. The full comparison is in Google, Yahoo, and Microsoft sender requirements.

Common misconceptions

  • "The platform says DKIM passes, so we're fine." Many hosted services sign with their own domain by default. DKIM passes, but it isn't aligned with your From domain, so it doesn't help DMARC. Ask the platform to sign with your domain (SPF include vs DKIM from the vendor).
  • "The DNS record is published, so DKIM is on." Signing also has to be switched on at the sender. In Google Workspace that's the Start authentication step.
  • "I'll test by emailing myself." you can't verify DKIM is on by sending yourself a test message. Send to an external mailbox and read the Authentication-Results header.
  • "A footer tool after signing is harmless." Adding a footer changes signed content and breaks the signature (Why DKIM signatures fail).

Once DKIM is signing with your domain, your DMARC aggregate reports list each source's DKIM domain, selector, and result, so you can see which senders are aligned and which aren't (A field-by-field walk-through of a DMARC aggregate report). Keys should also be rotated now and then (How to rotate a DKIM key).

Free DMARC account

Turn raw DMARC reports into a readable dashboard

Point your rua address to our platform and read the results by sender and source instead of opening XML files.

  • Results grouped by sending source
  • SPF, DKIM and alignment results per sender
  • The original XML reports are still there to download

Create a free DMARC accountTalk to an expert

FAQ

What is DKIM in email, in one sentence?

It's a signature a mail system can add to outgoing messages. Receivers check it against a public key in the signing domain's DNS to confirm that domain signed it and the signed parts weren't changed.

Does DKIM check the From address I see?

Not by itself. It authenticates the d= domain. DMARC is what requires that domain to align with the From address.

Is DKIM the same as DMARC?

No. DKIM signs messages. DMARC checks whether SPF or DKIM passed for a domain aligned with the From address, tells receivers what the domain owner asks them to do with mail that fails, and can request reports.

Can one email have more than one DKIM signature?

Yes. DMARC needs one valid signature that aligns with your From domain. Gmail checks only the first five listed in Authentication-Results.