DKIM Record Generator
Make a DKIM key pair in your browser and get the record to publish. On Google Workspace or Microsoft 365? They make the key: we show where.
Looks for keys your domain already publishes and who made them. Or choose who signs your mail below.
Built in your browser. Only DNS questions leave it, over HTTPS to Cloudflare's resolver (Google's as a second opinion).
Generate a key for example.com
Made in your browser with Web Crypto. The private key never leaves this tab.
What RFC 8301 asks for. The usual choice.
Advanced
Your key
Works offline: turn your Wi-Fi off and generate again.
Set up OpenDKIM
# Key file: only the opendkim user may read it $ sudo mkdir -p /etc/opendkim/keys/example.com $ sudo nano /etc/opendkim/keys/example.com/s.private $ sudo chown -R opendkim:opendkim /etc/opendkim/keys $ sudo chmod 600 /etc/opendkim/keys/example.com/s.private
Rotation plan
- TodayPublish , then start signing with it.
- In six monthsMake …, publish it beside .
- SwitchSign with ….
- 7 to 30 days laterKeep published for mail still in transit.
- RevokePublish an empty key at , don't delete it.
v=DKIM1; k=rsa; p=
After you publish
How do I generate a DKIM key and record?
To create a DKIM record, make an RSA 2048 key pair, keep the private key on the server that signs your mail, and publish the public key as a TXT record at selector._domainkey.yourdomain (RFC 6376).
Pick a new selector name for every key, such as the month it was made, so the old key can stay published while mail signed with it is still on its way.
Then install the private key in your signer and send a test message: the DKIM-Signature header names the domain (d=) and selector (s=) receivers will look up.
DKIM-Signature: v=1; a=rsa-sha256; d=example.com; s=s202610; …s202610._domainkey.example.comreceivers verify with it ✓
A private key no other script can readMade and kept in an isolated frame that can't reach the network.The form your signer readsPKCS#8, PKCS#1 or one line of base64, picked for your signer.Zero requests, and it works offlineA live count of network requests since you pressed Generate.Your signer's filesOpenDKIM, rspamd, Exim, Postfix or Amazon SES, with your domain and selector filled in.A dated selectorIts name says when the key was made; the rotation plan below dates the next key and the revocation.Do I need to generate my own DKIM key?
Only if your own server signs your mail: Google Workspace, Microsoft 365 and most email services make the key themselves and show you the record to publish, so a key from any generator would never be used.
Your own key matters for Postfix with OpenDKIM, rspamd, Exim, Haraka, your own app, and services that accept one, like Amazon SES (BYODKIM) and Mailgun.
| Sender | Key made by | You publish | Selectors |
|---|---|---|---|
| Google Workspace | the provider | TXT (their key) | |
| Microsoft 365 | the provider | CNAMEs to their keys | selector1, selector2 |
| SendGrid | the provider | CNAMEs to their keys | s1, s2 |
| Mailchimp | the provider | CNAMEs to their keys | k2, k3 |
| Postmark | the provider | TXT (their key) | <date>pm |
| Brevo | the provider | CNAMEs to their keys | brevo1, brevo2 |
| Zoho Mail | the provider | TXT (their key) | zoho |
| Amazon SES | either | TXT (your key) | any |
| Mailgun | either | TXT (your key) | any |
| OpenDKIM | you | TXT (your key) | any |
| rspamd | you | TXT (your key) | any |
| Exim | you | TXT (your key) | any |
RSA 1024, 2048, 4096 or Ed25519?
Use RSA 2048: 1024 is the minimum receivers accept, 4096 strains DNS, and Ed25519 is short but independent tests found the big mailbox providers don't verify it, so it only helps beside an RSA signature.
Many tools still default to 1024: opendkim-genkey, rspamd's dkim_keygen and Microsoft 365. RFC 8301 asks for 2048.
If you add Ed25519, sign with RSA too, under a second selector; Yahoo may not pass DMARC when one of several aligned signatures fails.
How do I set up OpenDKIM, rspamd or Exim?
Store the private key where only the signer can read it, map your domain and selector to it in the signer's config, and restart; the tabs show each signer's files with your names filled in.
Check the result by sending yourself a message and reading its DKIM result in the headers, or with our DKIM checker.
# /etc/opendkim/KeyTable s202610._domainkey.example.com example.com:s202610:/etc/opendkim/keys/example.com/s202610.private # /etc/opendkim/SigningTable *@example.com s202610._domainkey.example.com # /etc/opendkim/TrustedHosts 127.0.0.1 localhost
# /etc/rspamd/local.d/dkim_signing.conf domain { example.com { selector = "s202610"; path = "/var/lib/rspamd/dkim/example.com.s202610.key"; } } # only if example.com is a subdomain: use_esld = false; # only if users log in without @example.com: allow_username_mismatch = true; $ sudo rspamadm configtest && sudo systemctl restart rspamd
Why is my DKIM record split into several strings?
A 2048-bit key record is about 410 characters, longer than one 255-byte TXT string, so DNS stores it as two strings that verifiers join with nothing between them.
Cloudflare, Azure and cPanel-style panels take the whole value and split it; Route 53 and Google Cloud DNS want you to paste the quoted strings. GoDaddy caps a value at 1,024 characters.
v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtw0DwsqwlKexAE5H5WDgWwJlEz/C+7FIeL9/Y1TahjkvMvvX+lUQofjxhVmt/yMXVjvgrYb9jZIxtG96iO9qggOWi0vAeClBst4m3rj3O7GjkC/dfbG2BhQBpwJYt6ec76B8y6cyHBZ0+hMWGfAxuLQt/kkiVsaqwRxRQvEuMfnL4L9S8I7evV8GHFihlEgIaM9W8ag4zzL0ZxiEeznDaHYmJDbmgzarExXIY1IuMdpPu1/GmSrq9RCHEifKVvKsOPcmbv2u6xMbW63/EZmPIY78eZRqkioT8TangIPKsP7HEFZRKQwnQJy/OybqexdiFmt29BXBo7A745shhzueGQIDAQABs202610._domainkey.example.com. 3600 IN TXT ( "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtw0DwsqwlKexAE5H5WDgWwJlEz/C+7FIeL9/Y1TahjkvMvvX+lUQofjxhVmt/yMXVjvgrYb9jZIxtG96iO9qggOWi0vAeClBst4m3rj3O7GjkC/dfbG2BhQBpwJYt6ec76B8y6cyHBZ0+hMWGfAxuLQt/kkiVsaqwRxRQvEuMfnL4L9S8I7evV8GHFihlEgIa" "M9W8ag4zzL0ZxiEeznDaHYmJDbmgzarExXIY1IuMdpPu1/GmSrq9RCHEifKVvKsOPcmbv2u6xMbW63/EZmPIY78eZRqkioT8TangIPKsP7HEFZRKQwnQJy/OybqexdiFmt29BXBo7A745shhzueGQIDAQAB" )
How do I rotate DKIM keys?
Publish a new key under a new selector, switch signing to it, keep the old record 7 to 30 days for mail still in transit, then revoke it with an empty p=; M3AAWG says rotate at least every six months.
Revoke rather than delete, so verifiers report the old selector as revoked. Never reuse a selector name for a new key.
s202611signskept 7–30 daysp= (revoked)s202705signsIs it safe to generate a DKIM key online?
Only if the key is made in your browser and never sent: this page makes it with Web Crypto inside an isolated frame that can't reach the network, which you can confirm in your browser's developer tools.
Some online generators make the key on their server and send it back in the response, where it could be logged or kept. A key made in your browser exists only in your tab until you save it.
No other script on this page can read the frame that holds the key, and the page works offline: turn your Wi-Fi off and generate again.
GET /generate?key_size=2048200 {"private_key": "-----BEGIN…"}can be loggedDKIM Record Generator FAQ
What is a DKIM record?
Is it safe to generate DKIM keys here?
Which key size should I use?
Do I need a DKIM key for Google Workspace or Microsoft 365?
What is a DKIM selector?
What format is the private key?
Can a domain have more than one DKIM record?
Why is my DKIM record longer than 255 characters?
What does t=y mean in a DKIM record?
How often should I rotate DKIM keys?
Missing something?Suggest a feature or a new tool
Related tools
PGP Key Generator
Create an OpenPGP key pair in your browser: Ed25519 or RSA, a passphrase, an expiry date and a revocation certificate, with which apps accept it
DMARC Record Generator
Build your DMARC record for RFC 9989, starting from the one you publish now, and see what receivers will do with mail that fails.
SPF Record Generator
Build a valid SPF TXT record for your email providers and servers, with a live check of the 10 DNS lookup limit
DKIM Checker
Find a domain's DKIM keys across 140 common selectors, or verify an email's signature
DMARC Checker
Check any domain's DMARC policy the way receivers read it, with reports, SPF and DKIM
SPF Record Checker
Validate SPF records and check DNS lookup count per RFC 7208
MX Lookup
Find mail exchange records and mail server details
Email Header Analyzer
Parse raw email headers and trace the email journey