DKIM Setup Guide 2026 - How to Create and Publish a DKIM Record | BounceZero
BlogEmail Authentication

DKIM Setup Guide 2026
Generate, Publish, and Verify Your DKIM Record

DKIM (DomainKeys Identified Mail) is a cryptographic signature that proves your emails were not tampered with in transit and that your domain authorised the send. Without a valid DKIM record, Gmail, Outlook, and Yahoo treat your emails as higher risk - and since 2024, DKIM is mandatory for bulk senders. This guide covers setup for Google Workspace, Microsoft 365, and custom SMTP configurations.

By BounceZero Team |July 2026 |8 min read
2048-bit
Recommended RSA key length - never use 1024-bit
selector._domainkey
DNS TXT record hostname format
15-60 min
Typical DNS propagation time after publishing

How DKIM Works

DKIM uses public-key cryptography. You generate a key pair: the private key stays on your mail server and signs every outgoing email. The public key is published in DNS as a TXT record. When a receiving mail server gets your email, it fetches the public key from DNS and verifies the signature.

Private key

Stays on your mail server. Signs the email headers and body hash. Never shared, never in DNS.

Public key

Published in DNS as a TXT record at selector._domainkey.yourdomain.com. Anyone can read it to verify signatures.

DKIM-Signature header

Added to every outgoing email. Contains the selector name, algorithm, signed headers, and the signature itself.

Verification

Receiving server fetches your public key from DNS, recomputes the hash, compares to the signature. Pass = authenticated.

DKIM Setup: Google Workspace

1
Go to Google Admin Console

admin.google.com › Apps › Google Workspace › Gmail › Authenticate email

2
Select your domain and click Generate new record

Choose 2048-bit key length. Set a selector name - Google uses “google” by default, but you can use any string (e.g. “mail2026”).

3
Copy the TXT record values

Google gives you the full hostname and value. The hostname looks like: google._domainkey.yourdomain.com

4
Add the TXT record to your DNS provider

In Cloudflare, GoDaddy, Namecheap, or your registrar: add a TXT record with the hostname and value Google provided. TTL 3600 is fine.

5
Return to Google Admin and click Start authentication

Google will verify the DNS record and enable DKIM signing for all outgoing mail.

DKIM Setup: Microsoft 365

1
Go to Microsoft 365 Defender

security.microsoft.com › Email & Collaboration › Policies & Rules › Threat Policies › Email Authentication Settings › DKIM

2
Select your domain and click Enable

M365 generates the key pair automatically. It shows you two CNAME records (not TXT records - this is different from Google).

3
Add two CNAME records to DNS

M365 uses CNAME records that point to Microsoft’s infrastructure. Hostname format: selector1._domainkey.yourdomain.com

4
Wait for propagation (15-60 minutes)

Return to the DKIM settings page and click Enable again once DNS has propagated. The status should change to Enabled.

DKIM TXT Record Format

For custom SMTP setups (Postfix, Exim, PowerMTA), you generate the key pair yourself and publish the public key as a TXT record:

DNS TXT Record
Hostname: mail._domainkey.yourdomain.com
Value:    v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA...
                             (your 2048-bit public key here)
v=DKIM1

Version tag - always DKIM1

k=rsa

Key type - RSA is standard

p=...

Base64-encoded public key

⚠ If your public key is longer than 255 characters (which 2048-bit keys are), you must split the TXT value into multiple quoted strings. Most DNS providers handle this automatically when you paste a long value.

How to Verify DKIM Is Working

Method How What to look for
MXToolbox DKIM Lookup mxtoolbox.com/dkim › enter domain + selector name “DKIM Record Published” in green; public key displayed
dig command dig TXT selector._domainkey.yourdomain.com ANSWER section shows the p= public key value
Gmail header check Send yourself an email › Gmail › three dots › Show original Authentication-Results: dkim=pass (2048-bit key)
Mail-Tester.com Send to the test address shown at mail-tester.com DKIM section shows green pass; 10/10 score possible
Google Admin (for Workspace) Admin Console › Gmail › Authenticate email Status shows “Authenticating email” in green

Common DKIM Mistakes

Using 1024-bit key length

1024-bit is deprecated. Google, Yahoo, and security scanners flag it. Always generate 2048-bit. If your current key is 1024-bit, rotate it: generate a new 2048-bit key with a new selector, publish both, then remove the old one after 48 hours.

Wrong selector name in DNS

The hostname in DNS must exactly match the “s=” tag in the DKIM-Signature header. If your mail server signs with s=google but your DNS record is at s=mail, verification fails.

Not publishing DKIM for sending domains (only primary domain)

Every domain you send email from needs its own DKIM record. Sending domains (e.g. trybouncezero.io) need DKIM too, not just the main domain.

Modifying email in transit

If a mailing list, forwarding service, or spam filter modifies the email body or headers after signing, DKIM breaks. Exclude mailing list additions from the signed headers, or use ARC (Authenticated Received Chain) for forwarding.

No DMARC after setting up DKIM

DKIM alone prevents tampering but DMARC is what tells receiving servers what to do when DKIM fails. Always pair DKIM with a DMARC record (start with p=none).

DKIM is one piece - your list is another

A valid DKIM record protects your authentication. A clean list protects your bounce rate. Both matter for deliverability. Verify before every campaign - 100 free credits, no card required.

AL

Written by

Ayoub Lebda

Founder, BounceZero - Email-infrastructure engineer

Ayoub built BounceZero's 5-stage validation pipeline, its dedicated BGP-announced IP infrastructure, and the Patroni HA PostgreSQL cluster behind every verification. Previously built high-volume email delivery infrastructure. Trained at 1337 Benguerir (École 42 network, 2019). Open-source: bgp_analyzer.

Deliverability & sender reputation

Provider behaviour, DNS setup, warm-up, and inbox placement