Skip to content
DMARC Pulse

Learn

What is DKIM? DKIM signing and keys explained

What is DKIM? A signature that ties an email to a domain, checked with a public key in DNS. How signing works, a sample record and common mistakes.

What it is

What is DKIM? DKIM (DomainKeys Identified Mail) is an email authentication standard that lets a domain sign each message with a private key, so the receiving server can check the signature with a public key published in DNS. The signature is tied to a domain name and carried in a message header.

A valid signature shows that a domain took responsibility for the message and that the signed content has not changed since signing. DKIM does not encrypt anything. A failed check does not force a rejection by itself. The signing domain can also differ from the domain in the From address.

How DKIM signing works

  1. The sending system hashes the message body, which means it computes a short fingerprint of it. The result goes in the bh= tag of a new DKIM-Signature header.
  2. It signs the header fields listed in h=, plus DKIM-Signature itself, with the private key. The result goes in b=.
  3. The receiving server reads the signing domain in d= and the selector in s=, which names the key to use. It fetches the public key from a DNS TXT record at <selector>._domainkey.<domain>.
  4. It recomputes the hashes, compares the body hash with bh= and verifies b= with the public key. A receiver that adds an Authentication-Results header records dkim=pass for a signature that verifies and that its local policy accepts.

What is a DKIM key?

A DKIM key is one half of a key pair. The private key stays with the system that signs your mail. The public key sits in DNS for any receiver to fetch.

A domain can publish several keys, one per selector, so each server or provider can sign with its own. In Google Workspace, the default selector is google, published as a TXT record. For a custom domain, Microsoft 365 uses selector1._domainkey and selector2._domainkey as CNAME records (DNS aliases).

RFC 8301 rules out rsa-sha1, requires RSA keys of at least 1024 bits and advises at least 2048. To create a key, see how to set up DKIM.

DKIM and DMARC

DKIM is one of the two mechanisms behind DMARC, the policy check on the From address. DMARC counts a DKIM pass only when the d= domain aligns with the From domain. In the default relaxed mode, d=example.com aligns with mail from news.example.com.

Example

This signature is illustrative. The selector brisbane comes from the example in RFC 6376, and long values are shortened.

DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=example.com; s=brisbane;
  h=from:to:subject:date; bh=2jUSOH9NhtVGCQWN...; b=AuUoFEfDxTDkHlLXSZEp...
  • v=1 and a=rsa-sha256: the signature version and the signing algorithm.
  • c=relaxed/relaxed: how the header and body are normalized before hashing, a step called canonicalization. relaxed tolerates common changes such as line rewrapping in headers. simple tolerates almost none.
  • d=example.com and s=brisbane: the domain that takes responsibility and the selector.
  • h=: the signed header fields. From must be one of them.
  • bh= and b=: the body hash and the signature.

In this example, the public key would sit in a TXT record at brisbane._domainkey.example.com:

v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A...

p= holds the public key, shortened here. An empty p= means the key was revoked. To read a real record, use the DKIM Checker.

Common mistakes

  • Assuming a DKIM pass means DMARC passes. A service can sign with its own domain in d=. The signature verifies but does not align with your From domain. Where the service allows it, have it sign with your domain.
  • Publishing the key at the wrong name. Microsoft notes that most DNS providers add your domain to the host name automatically. Typing the full name then creates brisbane._domainkey.example.com.example.com. At those providers, enter only brisbane._domainkey.
  • Cutting a long key short. Google warns that a 2048-bit key cannot go in as one string where the limit is 255 characters. Split it into quoted strings in the same record, and keep one TXT record per selector.
  • Reusing a selector for a new key. RFC 6376 advises new selectors for new keys. Publish the new key under a new selector, confirm it appears in DNS, then switch the signer. Caution: keep the old key in DNS until mail signed with it has reached its destination. If you remove it early, that mail can fail DKIM. If your DMARC policy is p=quarantine or p=reject, receivers may then junk or refuse it unless SPF passes and aligns.
  • Changing the message after signing. Mailing lists that tag the subject or add a footer can invalidate the signature, as RFC 6377 explains. A changed body shows up as body hash did not verify.

Check it now

Find and validate DKIM keys

Frequently asked questions

Does DKIM encrypt my email?
No. RFC 6376 says no attempt is made to include encryption in DKIM. It adds a signature in a header field and leaves the message text as it was.
What is the difference between SPF and DKIM?
SPF lets a domain authorize the hosts that may use its name. DKIM signs the message with a private key, and the receiving server checks the signature with the matching public key published in the domain's DNS. Intermediate systems that leave the signed parts unchanged do not break the signature, but it can still fail if the key is removed from DNS. See SPF, DKIM and DMARC compared.
Do I need DKIM if I already have SPF?
Google requires SPF or DKIM from all senders to Gmail accounts, and both at more than 5,000 messages a day. DKIM also gives DMARC a second way to pass, because DMARC needs only one aligned result.

Sources consulted

RFC 6376 §1: Introduction
checked 2026-11-08
RFC 6376 §3.1: Selectors
checked 2026-11-08

Related pages

Keep it healthy

Know the moment something breaks

Point your DMARC reports to DMARC Pulse and see who sends email as your domain, what fails and why — with a calm alert when anything changes.

Free plan: 1 domain, no credit card.