SSL Checker DMARC Meta Tags Site Speed Broken Links AI Chat Bookings Try ModusOp

Published 27 April 2026

DomainKeys Identified Mail (DKIM) attaches a cryptographic signature to every outgoing message, generated using a private key controlled by your domain. Receivers verify the signature against your public key, published in DNS. If the signature checks out, the receiver knows two things: the message genuinely came from someone with access to your DKIM private key, and the message hasn't been modified in transit.

Where SPF only checks "did this connection come from an authorised IP", DKIM checks the message itself. That makes it the only email authentication mechanism that survives forwarding, mailing lists, and most aliasing — because the signature lives in the message headers and travels with the message no matter how many hops it takes.

What DKIM Looks Like

An outgoing email signed with DKIM has a header like this:

DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
    d=example.com; s=20260427;
    h=From:To:Subject:Date:Message-ID;
    bh=lOhX7Cv5i8cCerGv4LU6ngDd7A=;
    b=W3hYj2kP9LZxQ/...long base64 signature.../+pNsNmE0XtNz=

Reading the key tags:

Selectors

The selector is a label that tells the receiver where to find your public key. Combined with your domain, it forms a DNS query:

{selector}._domainkey.{domain}

So s=20260427 on domain example.com means the receiver looks up 20260427._domainkey.example.com for the public key.

You can have multiple selectors active at once. Common patterns:

How Signing Works

  1. Your sending server holds a DKIM private key.
  2. Outgoing message: server computes a hash of the relevant message body and headers, signs that hash with the private key, attaches the signature as a DKIM-Signature header.
  3. Receiver: looks up {selector}._domainkey.{domain} to retrieve the public key, recomputes the hash, verifies the signature using the public key.
  4. Match → DKIM passes. Mismatch → DKIM fails.

The signing happens automatically once configured. The configuration is the harder part.

How to Set Up DKIM

Setup depends on who's doing the sending:

Google Workspace / Microsoft 365

Both generate a DKIM keypair for you in the admin console. You publish the resulting public key as a TXT record on a specific selector (e.g. google._domainkey.yourdomain.com). Then enable signing in the admin panel. The provider handles signing every outbound message automatically.

Transactional senders (SendGrid, Mailgun, Postmark, AWS SES)

Each provider has a DKIM setup wizard that gives you a CNAME or TXT record to publish in DNS. Once published, the provider verifies the records and starts signing all outbound mail through their service. Some providers use multiple selectors (e.g. SendGrid uses s1._domainkey and s2._domainkey) so you'll be publishing two records.

Self-hosted (Postfix, Exim, etc.)

Generate a 2048-bit RSA keypair locally:

openssl genrsa -out dkim-private.pem 2048
openssl rsa -in dkim-private.pem -pubout -out dkim-public.pem

Configure your MTA's DKIM milter (e.g. opendkim) with the private key and selector. Publish the public key as a TXT record:

{selector}._domainkey.example.com  TXT  "v=DKIM1; k=rsa; p=MIIBIjANBgkq...long base64 public key..."

Test by sending a message to a Gmail account; check the Authentication-Results header for dkim=pass.

Key Sizes and Algorithms

The current minimum acceptable key size is 1024 bits, but 2048 is now the recommended default. Some receivers (Google in particular) flag 1024-bit DKIM as "weak" and may not give it full credit even when it verifies. Use 2048.

4096 bits is occasionally seen but not standard — older receivers may have buffer issues, and the security improvement is marginal. 2048 is the sweet spot for both compatibility and security.

For algorithms, RSA with SHA-256 (rsa-sha256) is current. SHA-1 is deprecated. ED25519 signatures are defined in RFC 8463 but receiver support is still patchy in 2026; use only as a secondary signature alongside RSA, not as a replacement.

DKIM Key Rotation

You should rotate DKIM keys periodically — every 6–12 months for active rotation, or at minimum after any incident where the private key may have been exposed. The rotation procedure:

  1. Generate a new keypair with a new selector (e.g. 20260427 instead of 20251015).
  2. Publish the new public key at {new-selector}._domainkey.example.com.
  3. Wait for DNS propagation. Verify with dig from a remote network.
  4. Configure the MTA to sign with the new selector. The old selector is left in place.
  5. Wait at least 7 days. Any in-flight messages signed with the old key need time to be delivered before the old public key disappears.
  6. Remove the old public key from DNS.
  7. Decommission the old private key.

The 7-day overlap is critical. Removing the old public key before all old-signed messages have been verified means those messages will fail DKIM, which under a strict DMARC policy means they get rejected — even though they were legitimately sent.

Why DKIM Survives Forwarding

SPF authenticates the connection. When mail is forwarded, the connection IP changes — the forwarder is now the sender, and unless they're listed in the original domain's SPF, SPF fails.

DKIM authenticates the message. The signature is in the headers; it travels with the message. As long as the forwarder doesn't modify the signed headers or body in ways that break the canonicalization rules, the signature remains valid through any number of hops.

This is why DMARC requires either SPF or DKIM to pass with alignment — DKIM is the one that gets you through forwarders, mailing lists, and aliases.

Where DKIM Can Still Fail

Verifying DKIM Is Working

Send a message to a test inbox at Gmail, Outlook, or Yahoo. Look at the message source for the Authentication-Results header:

Authentication-Results: mx.google.com;
    dkim=pass [email protected] header.s=20260427

dkim=pass means the signature verified. The header.i shows the signing domain, and header.s shows the selector that was used.

For ongoing verification, run your domain through DMARC Dashboard — the report covers DKIM publication and lets you spot missing or misconfigured records before email starts failing.

The DKIM Checklist

Once DKIM is working across every legitimate sender, DMARC has the foundation it needs to start rejecting spoofed mail with confidence.

Verify DKIM on your domain

DMARC Dashboard checks DKIM, SPF, and DMARC together — see what's published and what's missing in seconds.

Check Your Domain →