DKIM Explained: What It Is, How DKIM Records Work & How to Check Yours
Published November 2026 \u2014 Current as of November 2026 \u2014 Estimated read time: 10 minutes
An email claiming to be from your domain can arrive with the correct sender address and a legitimate-looking body, yet have been forged somewhere else entirely. SPF checks that the sending computer is on an authorized list. DKIM goes further: it cryptographically signs the message so the receiver can verify the message was not altered in transit and that it genuinely came from a server holding your domain's private key. This guide explains what DKIM is, how DKIM signatures work, what DKIM selectors are, and how to check your domain's DKIM record — free.
If you only need to check one domain right now, use the free DKIM Key Scanner — it discovers every DKIM key selector published for your domain, validates each key's cryptographic parameters, flags weak key lengths, and scores your DKIM configuration. The rest of this article is the how-it-works manual behind that result.
Why DKIM Exists: Beyond IP Authorization
SPF solves one problem: it tells receivers which IP addresses are allowed to send mail for your domain. But SPF has a blind spot — email forwarding. When a message passes through a forwarder, the original sender's SPF check happens against the forwarder's server, which is not authorized. SPF fails even though the message is legitimate. DKIM solves this by attaching a cryptographic signature to the message itself that survives forwarding unchanged.
A second weakness of SPF is that it authenticates the envelope, not the content. Even if the sending IP passes SPF, the message body could have been intercepted and modified between the authorized server and the receiver. DKIM's signature covers specific headers and the body, so tampering is detectable. When both SPF and DKIM pass, the receiver knows the message came from an authorized sender and was not altered.
DKIM is defined in RFC 6376 (updated from RFC 4871) and uses standard public-key cryptography. The sending domain generates a public/private key pair: the private key stays on the mail server, and the public key is published as a DNS TXT record at a special subdomain.
How DKIM Works, Step by Step
DKIM does not inspect the entire connection. Instead it wraps a digital signature around every outgoing message so receivers can verify three things: the message was not tampered with, it originated from a server holding the domain's private key, and specific header values (like From) match what the signer intended.
- Outbound server signs the message. The sending mail server takes the message body and selected headers, hashes them, and signs the hash with the private key. The signature is added as a new
DKIM-Signatureheader on the outgoing email. - Receiving server retrieves the public key.When the message arrives, the receiver reads the
s=(selector) andd=(domain) tags from the signature header, then performs a DNS TXT lookup at<selector>._domainkey.<domain>. - Receiver verifies the signature. Using the public key from the DNS lookup, the receiver re-computes the hash of the body and headers, decrypts the signature, and compares the two. If they match, DKIM passes. If they do not — the message was altered in transit, or the signing server lost its private key — DKIM fails.
The critical detail is that the signature is stored in the message headers, not in DNS. The DNS record holds only the public key material needed to verify the signature. This is what makes DKIM survive forwarding: the signature travels with the message, so even after it passes through intermediate servers, the receiver at the final destination can still verify it.
DKIM Signature Header Anatomy
Every DKIM-signed message carries a DKIM-Signature header that looks like this:
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=example.com; s=google; h=from:to:subject:date:message-id; bh=abc123...; b=def456...The tags break down as follows:
- v=1 — DKIM version. Currently always 1.
- a=rsa-sha256 — The signing algorithm. RSA with SHA-256 is the standard. Some newer configurations use ed25519-sha256 (RFC 8463).
- c=relaxed/relaxed — Canonicalization method for the header and body.
relaxed/relaxedallows minor whitespace changes;simple/simpleis strict and will break on the tiniest reformatting by intermediate servers. - d=example.com — The signing domain. This is the domain that takes responsibility for the signature.
- s=google — The selector. This tells receivers which DNS TXT record to fetch. The full lookup is
google._domainkey.example.com. - h=... — Signed headers. A colon-separated list of header fields the signature covers. If a covered header is modified in transit, the signature breaks and DKIM fails.
- bh= — Body hash. The hash of the message body, base64-encoded.
- b= — The actual digital signature (base64-encoded). This is the encrypted hash that receivers verify using the public key from DNS.
DKIM Selectors: Why You Need More Than One
A DKIM selector is a label that identifies which public key to use for a given message. Because the selector is part of the DNS lookup path (s=selector._domainkey.d=domain), you can publish multiple keys under different selectors and rotate them independently.
Selectors serve several operational uses:
- Key rotation. Every 12–24 months you should generate a new key pair under a new selector, update your mail server, then remove the old selector. The overlap period means already-sent messages signed with the old key still verify while new messages use the new key.
- Third-party senders. Each email service provider (Google, Microsoft, SendGrid, SparkPost, Mandrill) uses its own selector. They publish the corresponding public key in your DNS zone. Running the DKIM Key Scanner on your domain reveals every selector currently in use.
- BIMI alignment. Brand Indicators for Message Identification (BIMI) requires a DKIM signature for the logo to display in supporting mail clients. The BIMI CNAME record points to the selector your domain uses for authenticated email.
Common DKIM selectors by platform:
| Platform | Selector | DNS Lookup |
|---|---|---|
| Google Workspace | google._domainkey.example.com | |
| Microsoft 365 | selector1 / selector2 | selector1._domainkey.example.com |
| Amazon SES | amazonses | amazonses._domainkey.example.com |
| SendGrid | sesmail | sesmail._domainkey.example.com |
| SparkPost | sparkpost | sparkpost._domainkey.example.com |
Your domain may have several selectors. Each one the DKIM Key Scanner finds is an active public key published in your DNS. If a selector appears that you do not recognize, investigate which service uses it — obsolete selectors are a maintenance risk and should be cleaned up.
DKIM Key Length: 1024 vs 2048 Bits
DKIM signatures use RSA key pairs by default. Two key lengths are common:
- 1024-bit RSA. The historical default. 1024-bit keys are still accepted by most receivers, but the security margin is narrowing. Major providers began deprecating 1024-bit keys years ago — they are now the minimum, not the recommended length.
- 2048-bit RSA. The current best practice. 2048-bit keys are not expected to be broken with any known technology over the next decade. The tradeoff is a slightly larger DNS record: a 2048-bit base64 key value is about 440 characters, easily within the TXT record size limit of 2,048 characters (RFC 6376 §3.4) or the practical 512-character UDP DNS limit (handled via DNS long-form responses).
The DKIM Key Scanner reports the key length of every selector it finds and flags keys below 2048 bits. If your email provider generated a key longer than 1024 bits (most now use 2048 by default), it is color-coded green. A key under 1024 bits is a critical finding and should be rotated immediately.
Some newer configurations use Ed25519 signatures (RFC 8463), which produce much shorter signaturesand stronger security per byte. Ed25519 DKIM is supported by Google, Fastmail, and a growing number of platforms. If your provider supports it, Ed25519 is an upgrade from RSA-2048.
How to Check Your DKIM Record
The fastest way is the free DKIM Key Scanner: type your root domain, and it scans all known selectors, retrieves each public key, evaluates the algorithm, key length, and DNS configuration, and produces a score out of 100. If DKIM is not configured at all, the tool explains exactly what to publish.
If you prefer the command line, use dig to query a specific selector manually:
dig TXT google._domainkey.example.com +shortReplace google with the selector you want to test, and example.com with your own domain. The output should be a single TXT string starting with "v=DKIM1;". If you receive NXDOMAIN (the record does not exist), that selector is not configured.
To see all selectors at once, run the DNS lookup on the combined SPF + DKIM + DMARC checker, which audits all three email authentication mechanisms in a single scan.
Common DKIM Mistakes
- Wrong DNS location. DKIM records must live at
<selector>._domainkey.<domain>, not at the domain apex. A common error is placing the key at_domainkey.example.comwithout the selector prefix — the scanner will not find it. Another common mistake is using the bare root domain record or a different subdomain entirely. - Missing or broken key rotation. Using a single key for years with no rotation plan. If that private key is compromised, every message signed with it becomes forgeable. Rotate selectors annually and use the overlap window to transition smoothly.
- Weak key length. 1024-bit RSA keys are still found on domains that set up DKIM years ago. Rotate to 2048-bit RSA (or Ed25519) as soon as your email provider supports it.
- DKIM without DMARC. DKIM alone does not tell receivers what to do when a message fails. A DMARC policy (p=quarantine or p=reject) is what turns DKIM from a reporting tool into an enforcement mechanism. Without a DMARC policy, a broken DKIM signature is silently ignored by most receivers.
- Selector removed before messages expire. Some email servers retry delivery for days. If you delete the old selector immediately after switching keys, messages still in flight will fail DKIM verification at the destination.
DKIM in the Email Authentication Triad
Modern email authentication rests on three DNS-based standards. SPF authorizes sending IP addresses. DKIM verifies message integrity and origin with a cryptographic signature. DMARC ties them together by telling receivers what to do when delivery checks fail and by providing feedback reports.
Each standard covers a weakness of the others. SPF breaks on forwarding. DKIM does not care about the sending IP, so it survives forwarding intact. DMARC requires either SPF or DKIM to produce an aligned pass, so if SPF fails on a forwarded message but DKIM passes, DMARC can still authorize delivery. Without all three, your domain has blind spots that attackers will exploit.
For the full setup picture, read the complete SPF, DKIM & DMARC guide, the SPF explained guide, and the DMARC setup guide. Then verify each record with the DKIM Key Scanner, the SPF Checker, and the DMARC Analyzer. If you manage several domains, the combined SPF + DKIM + DMARC check audits all three at once, and the Domain Security Scorecard folds email authentication into your overall domain hygiene score.
FAQ: DKIM Records
What does DKIM stand for? DomainKeys Identified Mail. Despite the name, DKIM is not tied to the original DomainKeys standard (which Yahoo developed in the early 2000s). DKIM was standardized by the IETF in RFC 4871 (2007) and updated in RFC 6376 (2011).
Is DKIM required for email delivery? Strictly speaking, no. Email can be sent and received without any authentication. In practice, major providers (Gmail, Outlook, Yahoo) increasingly quarantine or reject mail from domains that fail DMARC, and DMARC requires either SPF or DKIM to pass. Gmail 2024 bulk-sender requirements mandate DKIM signing for any domain sending more than 5,000 messages per day. Most legitimate senders need DKIM.
Can DKIM prevent phishing? DKIM alone does not prevent phishing because it only verifies the signing domain, not the visible From header an attacker puts in the message body. DMARC alignment closes this gap by requiring the From domain to match the domain that signed with DKIM (or passed SPF). For real phishing protection, DKIM must be paired with a DMARC reject policy.
What happens when a DKIM signature fails? The receiving mail server checks the DMARC policy for the domain. If DMARC is set to p=reject and neither SPF nor DKIM passes in an aligned way, the message is rejected. If p=quarantine, it goes to spam. If p=none, the message is delivered normally (the policy is report-only). Most domains operate at p=none while building their authentication infrastructure, then move to p=quarantine, and eventually p=reject.
How often should I rotate DKIM keys? Every 12–24 months. Generate a new key pair under a new selector name, publish the public key in DNS, update your mail server to sign with the new selector, and keep the old selector published for the overlap period — typically 30–60 days.
Can I have more than one DKIM key? Yes, and most domains do. Each third-party email service your domain uses typically has its own selector and key. Running the DKIM Key Scanner will show you every key and selector currently published for your domain.