Inboxlogy Free Tools
DKIM Generator
Create a DKIM keypair instantly — the public TXT record for your DNS and the private key for your mail server. Generated entirely in your browser; nothing is ever uploaded.
🔒 The keypair is generated entirely in your browser with the Web Crypto API. Nothing is sent to any server.
How it works
Choose selector and key size
Pick a selector name you will recognize later, such as a month and year, then a key size. 2048 bits is the sensible default. Selectors only need to be unique among the keys published on that domain.
Keypair is generated locally
The keypair is created in your browser with the WebCrypto API. The private key never leaves the page and is never sent to a server, so you can generate production keys without handing them to a third party.
Publish and install
Add the public half as a TXT record at selector._domainkey.yourdomain.com. Paste the private key into your mail server's DKIM configuration, restart the signing service, then send a test message and confirm a DKIM-Signature header appears.
How a DKIM keypair is used
DKIM is asymmetric signing applied to email. Your mail server hashes selected headers and the message body, signs that hash with the private key, and adds a DKIM-Signature header carrying the body hash in bh=, the signature in b=, the signed header list in h=, your domain in d= and the selector in s=. A receiver fetches the public key from DNS and checks the signature against what it recomputes.
The two halves have opposite handling. The public key goes into DNS as v=DKIM1; k=rsa; p= followed by base64, readable by anyone, because verification needs it. The private key goes only into your mail server configuration, with permissions that keep it off everything else. If it leaks, anyone can sign mail that validates as yours, and the only fix is a new keypair under a new selector plus deleting the old record.
Common mistakes
Publishing the private key
Copying the wrong block into the TXT record exposes your signing key and lets anyone forge signed mail for your domain. The record should contain only p= followed by the public key. If you publish the private half, rotate immediately.
Reusing one key everywhere
A single keypair shared across every domain and platform means one leak compromises all of them, and you cannot rotate one without breaking the rest. Generate a separate keypair per sending domain, and a separate selector per platform that signs for you.
Rotating by overwriting the record
Replacing the key at an existing selector breaks verification for mail already in transit or sitting in a queue. Publish the new key under a new selector first, switch signing to it, wait a few days, then delete the old record.
Leaving extra characters in p=
Line breaks, trailing spaces, BEGIN PUBLIC KEY wrappers and stray quotes inside p= all make the key undecodable, and every signature then fails. Strip the PEM header, footer and whitespace, then verify the published record with a DKIM checker before trusting it.
Frequently asked questions
What key size should I use for DKIM?
2048-bit RSA. It is the current norm, every major receiver verifies it, and it avoids the longevity problems of 1024-bit keys. The only cost is that a 2048-bit public key no longer fits in a single 255-character TXT string, so it has to be published as multiple strings inside one record. Most DNS providers handle that split automatically.
Can I generate DKIM keys without a tool like this?
Yes, with OpenSSL. Run openssl genrsa -out private.key 2048 to create the private key, then openssl rsa -in private.key -pubout to print the public half. Strip the PEM header, footer and newlines, and place the remaining base64 after p= in your TXT record. A browser-based generator just removes the formatting steps.
How often should I rotate DKIM keys?
Every six to twelve months is a reasonable cadence, and immediately if a key may have leaked. Rotation means publishing a new selector, pointing your mail server at the new private key, then removing the old record once mail signed with it has cleared. Several providers, Microsoft 365 among them, rotate automatically between selector1 and selector2.
Does DKIM encrypt my email?
No. DKIM only signs. The message body travels exactly as it would without DKIM, and anyone who can read the traffic can read the mail. What DKIM proves is that the signed parts were not altered in transit and that they came from a server holding your private key. Encryption in transit comes from TLS, not DKIM.
Do I need DKIM if I already have SPF?
Yes, for two reasons. DKIM survives forwarding, where SPF usually breaks because the forwarding server is not listed in your record. DKIM also gives DMARC a second alignment path, so one failure does not sink the whole check. A DMARC policy stronger than p=none is only safe once both authenticate and align.