What is DKIM?
DKIM (DomainKeys Identified Mail) is an email authentication standard that adds a cryptographic signature to every message your domain sends. Receiving servers check that signature against a public key published in your DNS to confirm the message really came from your domain and wasn't altered in transit.
By Stephen Williams · Updated
DKIM at a Glance
- Where it lives: A public key in a TXT record at selector._domainkey.yourdomain.com. Your mail provider keeps the private key.
- What it proves: The message was signed by a server holding your domain's key, and the signed headers and body weren't changed on the way.
- Why it matters: The signature travels with the message, so it usually survives forwarding when SPF doesn't.
How DKIM Works
Message Signed
The sending mail server generates a cryptographic hash of the email body and selected headers, then signs it with the domain's private key.Signature Attached
The signature is added as aDKIM-Signatureheader to the email, along with metadata like the selector and signing domain.Public Key Lookup
The receiving server uses the selector and domain from the signature to query DNS for the corresponding public key record.Signature Verified
The receiver uses the public key to verify the signature against its own hash of the message. If it verifies, the message is unchanged and was signed by the domain in d=.
Signature Components
- d= (Domain)
- The signing domain claiming responsibility
- s= (Selector)
- Points to the specific DNS key record
- b= (Signature)
- The Base64-encoded cryptographic signature
- bh= (Body Hash)
- Hash of the canonicalized message body
History Timeline
2004
DomainKeys by Yahoo
Yahoo developed DomainKeys, the predecessor to DKIM, introducing the concept of cryptographic email signatures tied to domain DNS records. Cisco simultaneously developed Identified Internet Mail.2007
RFC 4871 Published
DomainKeys and Identified Internet Mail were merged into DKIM and published as RFC 4871, creating a unified standard for cryptographic email authentication.2011
RFC 6376 Published
RFC 6376 replaced RFC 4871 and clarified canonicalization, key management and verification. It was later raised to Internet Standard (STD 76).2018
Ed25519 Support (RFC 8463)
RFC 8463 added Ed25519-SHA256 as a second signing algorithm, with much smaller keys than RSA.2024
Bulk Sender Requirements
Gmail and Yahoo began requiring DKIM from bulk senders in February 2024, and Outlook.com followed in May 2025.
Anatomy of a Signature
DKIM-Signature Header Tags
The DKIM-Signature header is added to every signed email and contains these key tags:
- v=1
- DKIM version (always 1)
- a=
- Signing algorithm (rsa-sha256 or ed25519-sha256)
- b=
- Base64-encoded digital signature
- bh=
- Body hash (canonicalized body content)
- c=
- Canonicalization (simple/relaxed for header/body)
- d=
- Signing domain (SDID)
- h=
- List of signed header fields
- s=
- Selector (locates the DNS key record)
- t= / x=
- Signature timestamp / expiration time
DNS Record Tags
The public credential is published as a DNS TXT record at selector._domainkey.example.com:
- v=DKIM1
- Record version (required)
- p=
- Base64-encoded public key (required)
- k=
- Key type (rsa or ed25519, default: rsa)
- h=
- Acceptable hash algorithms
- t=
- Flags (y=testing, s=strict domain match)
- n=
- Notes (human-readable, not interpreted)
RSA vs Ed25519 Algorithms
RSA (rsa-sha256)
- Advantage: Universal support across all email providers
- Advantage: Safe as your only signature; use 2048-bit keys
- Drawback: Larger key sizes create longer DNS TXT records
- Drawback: Slower signing and verification than Ed25519
Ed25519 (ed25519-sha256)
- Advantage: Strong security with much smaller keys (256-bit)
- Advantage: Faster signing and verification
- Drawback: Not yet supported by all email providers
- Drawback: Often deployed alongside RSA as a dual-signature setup
Why Your Domain Needs DKIM
DKIM keeps working where SPF stops. SPF checks the server that handed over the message, so it fails when a mailing list or forwarding rule passes your mail on. A DKIM signature travels in the message headers, so receivers can still verify it after forwarding.
For DMARC, a passing signature only counts when its d= domain matches the From address. Many services sign with their own domain by default, which passes DKIM but not DMARC, so set up DKIM with your domain at every service that sends for you.
Gmail, Yahoo and Outlook.com require DKIM from bulk senders. Receivers also track reputation by the signing domain, so signing consistently with your own domain keeps that reputation yours.
Common Mistakes to Avoid
Weak or Short Keys
Leaving Testing Mode On
t=y flag in DNS tells receivers the key is in testing mode, so DKIM failures are not enforced. Remove this flag once you have verified that signing works correctly.No Key Rotation
Wrong Canonicalization
simple/simple canonicalization causes DKIM failures when mail servers add or modify whitespace. Use relaxed/relaxed for maximum compatibility across different email infrastructure.Implementation Steps
Generate Your Credentials
Generate a 2048-bit RSA pair (or Ed25519 if your provider supports it). Most email platforms like Google Workspace, Microsoft 365, and SendGrid handle generation automatically.Publish the Public Record in DNS
Create a DNS TXT record atselector._domainkey.yourdomain.comcontaining your public value. The selector name is chosen by you (e.g.,google,s1,2026q1).Enable Signing and Validate
Configure your mail server or provider to sign outgoing emails with the private key, then use our DKIM Checker to verify the DNS record is published correctly and the signature validates.
DKIM FAQ
What is DKIM in email?
DKIM (DomainKeys Identified Mail) is an email authentication standard that adds a cryptographic signature to outgoing messages. Receiving servers verify the signature with a public key published in the sender's DNS, which confirms the message was authorized by the signing domain and wasn't altered in transit.
How does DKIM verify email integrity?
The sending server hashes the message body and selected headers and signs the result with a private key. The receiver recomputes the body hash and verifies the signature with the public key from DNS. If either check fails, the signed content changed after signing and DKIM fails.
What is a DKIM selector?
A selector is a name that tells receivers where to find the public key: the key is published as a TXT record at selector._domainkey.yourdomain.com, and the selector appears in the s= tag of the DKIM-Signature header. Selectors let a domain use several keys at once, for example one per email service, and rotate keys without downtime.
What is the difference between RSA and Ed25519 DKIM keys?
RSA keys (rsa-sha256) are supported everywhere; use at least 2048 bits. Ed25519 keys (ed25519-sha256, RFC 8463) are much smaller and faster but are not verified by every receiver, so they are usually deployed alongside an RSA signature rather than instead of one.
Do I need DKIM if I already have SPF?
Yes. SPF only authorizes sending servers and breaks when mail is forwarded, while a DKIM signature travels with the message and usually survives forwarding. DMARC can pass on DKIM alone, and Gmail, Yahoo and Outlook.com require both SPF and DKIM from bulk senders.
Check Your DKIM Record
Look up a key by selector, or leave the selector empty and the checker scans the ones common providers use.