DKIMDomainKeys Identified Mail
DKIM (DomainKeys Identified Mail) is an email-authentication standard, defined in RFC 6376, that attaches a cryptographic signature to every message. The receiver fetches your public key from DNS and uses it to confirm the mail was authorised by your domain and that the signed parts arrived unaltered. It is one of the two checks that DMARC aligns, and it travels intact through most forwarding.
- Proves a message was authorised by the signing domain and not tampered with in transit
-
The private key signs each message; the matching public key lives in a DNS
TXTrecord - Unlike SPF, a valid DKIM signature usually survives forwarding
-
A passing signature still fails DMARC unless its
d=domain aligns with theFrom:address
TXT (public key)
selector._domainkey.yourdomain.com
rsa-sha256 (SHA-1 prohibited)
DKIM-Signature:
How DKIM works
DKIM is a public-key signature system bolted onto email. You generate a key pair: a private key that stays on your sending server and a public key that you publish in DNS. When a message goes out, your server hashes the body and a chosen set of headers, signs that hash with the private key, and writes the result into a new DKIM-Signature: header on the message.
On the receiving side, the server reads the signature header, notes the signing domain (d=) and the selector (s=), and looks up the public key at selector._domainkey.d-domain. It then recomputes the hashes and verifies the signature. If the maths checks out, two things are proven at once: the message was signed by someone holding the private key for that domain, and the signed content was not altered after signing. Because no certificate authority is involved, all the trust flows through your control of DNS.
Anatomy of a DKIM signature
The signature is a set of tag=value pairs added directly to the message header. A real one looks like this:
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=example.com; s=mail2026; t=1718000000;
h=from:to:subject:date:message-id;
bh=2jUSOH9NhtVGCQWNr9BrIAPreKQjO6Sn7XIkfJVOzv8=;
b=hG7s9k...truncated...AoQ==
v=1: version. Always1.a=rsa-sha256: the signing algorithm. SHA-256 is required; RFC 8301 prohibits the oldrsa-sha1.d=example.com: the signing domain claiming responsibility. This is the value DMARC aligns against yourFrom:.s=mail2026: the selector, which points at one specific public key so you can run several keys and rotate them.c=relaxed/relaxed: the canonicalization (header / body), how tolerant the check is of whitespace and folding changes in transit.h=…: the exact list of headers that were signed.bh=…: the hash of the canonicalized body.b=…: the signature itself, covering the headers inh=plus the body hash.
The public-key DNS record
The matching public key is published as a single TXT record at selector._domainkey.yourdomain.com. The selector in the record name must match the s= tag in the signature, which is how a receiver finds the right key.
mail2026._domainkey.example.com. IN TXT "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEF...AQAB"
Why DKIM matters for sender reputation
Since February 2024, Google and Yahoo require every bulk sender (5,000 or more messages a day to their users) to authenticate with SPF and DKIM and publish DMARC. Microsoft applied the same baseline to high-volume senders into Outlook and Hotmail in 2025. DKIM is the half of that pairing that most reliably survives the real world: an aligned DKIM signature keeps passing DMARC even when a message is forwarded, where SPF usually breaks.
DKIM also anchors your domain reputation. Mailbox providers track sending behaviour against the stable d= domain in your signature, not the IP address you happen to use that day, so a consistently signed stream builds a track record you carry between IPs and providers. The current hygiene baseline is a 2048-bit RSA key signed with SHA-256, rotated periodically by publishing a new selector before retiring the old one.
How a DKIM signature is verified
DKIM-Signature: header is added and the message is sentd= and s= and looks up the public key in DNSs._domainkey.d
No record: result is none
DKIM vs SPF
| DKIM | SPF | |
|---|---|---|
| What it checks | A valid signature from the domain | The sending IP is authorised |
| Mechanism | Cryptographic signature + DNS key | DNS list of IPs |
| Identity used | The d= signing domain |
The Return-Path domain |
| Survives forwarding? | Usually yes | Usually no |
| Detects message tampering? | Yes | No |
By the numbers
rsa-sha1 for signing and verifying.Common mistakes
d= domain does not match your visible From:. Sign with your own domain so the signature aligns.rsa-sha1 is non-compliant with RFC 8301 and increasingly treated as a fail. Move every selector to rsa-sha256.Frequently asked questions
s= tag), a public key that was truncated or pasted with line breaks in DNS, a key length or algorithm the receiver rejects, or a mail gateway that modified the body after signing so the body hash no longer matches. Check the published record with a DKIM lookup and confirm nothing rewrites the message in transit.