Skip to main contentSkip to footer

DKIM Generator: Create a DKIM Key and DNS Record

Create an RSA or Ed25519 key pair inside your browser, get the DNS record in the format your panel accepts and check the key once it is published. The private key never leaves this page. Free, no sign-up.

The record is built in your browser and nothing you type below is sent anywhere. Only "Load published record" and "Check" ask our server, which reads public DNS for the domain.

Key type

One TXT record per line, as your DNS panel or dig TXT shows them. Two lines of the same kind are reported as an error, which is exactly the mistake this is meant to catch.

What is a DKIM record?

DKIM (DomainKeys Identified Mail, RFC 6376) lets a mail server sign every outgoing message with a private key. The matching public key is published as a TXT record at selector._domainkey.example.com. A receiver fetches it, verifies the signature and so knows that the message really comes from a server holding your key and was not changed on the way.

The generator creates the key pair with the browser’s own cryptography (WebCrypto), writes the DNS record and keeps the private key on this page until you save it. Nothing about the key is sent to our server.

Do you need a DKIM generator?

Your provider creates the key: you do not

Microsoft 365, Google Workspace, Brevo, Mailchimp, SendGrid, Amazon SES and almost every hosted service create the key pair themselves and show you the record to publish, often as a CNAME pointing to their own DNS. Use their record; a key from here would be useless to them because they would never see the private half.

You run the mail server: you do

Postfix with OpenDKIM, rspamd, Exim, a mail server in a container, a self-hosted newsletter tool or an application that signs its own mail: all of them need a key pair you create and a record you publish. That is what this generator is for. Most of these programs read the private key as a PEM file, which is the format you download here.

Create a DKIM key in three steps

1. Choose a selector and a key type. The selector is a name you pick, for example the current month like 202610. It appears in every signature as s= and lets you run several keys side by side. RSA 2048 is the right key type for almost everyone.

2. Generate, save, configure. Press “Generate key pair”, download the private key and put it on the mail server. Configure the server to sign for your domain with that selector. Keep the file private: anyone who has it can sign mail as you.

3. Publish and check. Add the TXT record, wait until it is visible, then enter domain and selector at the top and press “Load published record”. The check reads the key from DNS and reports its type and exact length.

How to add the DKIM record

Field Value
Type TXT
Name / Host 202610._domainkey, that is selector plus ._domainkey; the panel appends the domain
Value v=DKIM1; k=rsa; p=MIIBIjANBg...

A 2048-bit key produces a value of about 410 characters. A single TXT string may hold at most 255, so DNS stores longer values as several strings that the receiver joins together. Good panels do that on their own. For the others, the generator offers three forms of the same record:

  • One value for panels that split long values themselves (Cloudflare, most modern panels).
  • Split into 255-character strings, each in quotes, for panels that store exactly what you paste.
  • Zone file line in BIND syntax for your own name server.

If a panel refuses even the split form, it limits the total length. Then RSA 1024 is the fallback that every receiver still accepts, but change provider for DNS when you can.

What is in a DKIM record

Tag Meaning
v=DKIM1 Version. Optional by the standard, expected by many tools.
k=rsa or k=ed25519 Key type. rsa is the default if the tag is missing.
p= The public key in Base64. An empty p= means the key has been revoked.
t=y Testing: receivers treat a failing signature like an unsigned message.
t=s Strict: the key may only sign for exactly this domain, not for subdomains.
h= Allowed hash algorithms. Leave it out; sha256 is what everyone uses.

RSA 2048, RSA 1024 or Ed25519?

RSA 2048 is the standard: accepted by every receiver, considered safe, and only the length of the record causes trouble. RSA 1024 is the minimum receivers still accept; use it only when DNS forces you to. Ed25519 (RFC 8463) is modern and short, about 60 characters, but not every receiver verifies it yet. Publish it as a second key under its own selector next to an RSA key, never on its own.

Selectors of common providers

If you are looking for an existing key: Google Workspace uses google, Microsoft 365 selector1 and selector2, SendGrid s1 and s2, Mailchimp k2 and k3. Amazon SES uses three random tokens you find in the SES console. The Email Security Check tries these names automatically.

Without a browser: create the key with OpenSSL

The same key pair can be created on the server itself, which keeps the private key from ever touching a desktop.

RSA 2048:
openssl genrsa -out 202610.private.pem 2048
openssl rsa -in 202610.private.pem -pubout -outform der | openssl base64 -A
The second command prints the value that goes after p=.

Ed25519:
openssl genpkey -algorithm ed25519 -out 202610.ed25519.pem
openssl pkey -in 202610.ed25519.pem -pubout -outform der | tail -c 32 | openssl base64 -A
For Ed25519, DKIM publishes the raw 32-byte key, not the full structure, which is why the last 32 bytes are cut out.

rspamd users can run rspamadm dkim_keygen -s 202610 -d example.com -b 2048, which prints key and record in one go.

Rotating a DKIM key

A key that never changes is a key that can leak without anyone noticing. Rotate every six to twelve months, and immediately if a server holding the key was compromised. Rotation is painless with selectors: create a new key under a new selector, publish its record, switch the mail server to the new selector, and keep the old record in DNS for a week so that messages still in transit can be verified. Then publish the old selector with an empty p=, which tells receivers the key is revoked.

Naming selectors after the month they were created in, as the generator suggests, makes it obvious which key is current.

Frequently asked questions about the DKIM generator

Is my private key sent to you or stored?

No. The key pair is created with WebCrypto inside your browser and exists only in this tab. “Load published record” reads the public key from DNS, which is public anyway. Download the private key before you close or reload the page, because it cannot be recovered afterwards.

Do I need a DKIM generator for Microsoft 365 or Google Workspace?

No. Both create the key themselves. In Microsoft 365 you publish two CNAME records named selector1 and selector2 and then enable signing in the Defender portal; in Google Workspace you generate the key in the admin console under Gmail authentication and publish the TXT record shown there.

Which key length should I use for DKIM?

RSA 2048. It is accepted everywhere and considered secure. 1024 bits is the minimum and only worth choosing when your DNS panel cannot store a longer value. Longer than 2048 brings little and some receivers do not handle 4096-bit keys well.

What is a DKIM selector?

A name of your choice that points receivers to the right key. A signature carries s=202610, the receiver then looks up 202610._domainkey.example.com. Different services and old and new keys can each have their own selector without getting in each other’s way.

How often should I change the DKIM key?

Every six to twelve months, and at once if a server with the key was compromised. Publish the new key under a new selector first, switch signing over, and keep the old record for about a week before revoking it.

The value is too long for my DNS field. What now?

Use the split form, which divides the value into quoted strings of at most 255 characters. If the panel still refuses it, it limits the total length; then generate an RSA 1024 key, which yields a value of about 220 characters.

How this tool works and its limits

RSA keys are created with RSASSA-PKCS1-v1_5 and SHA-256 at 2048 or 1024 bits, Ed25519 keys with the browser’s Ed25519 implementation where it exists; older browsers do not offer Ed25519 and the generator says so. The private key is exported as PKCS#8 PEM, which OpenDKIM, rspamd and Exim read. The public key is published as SubjectPublicKeyInfo for RSA and as the raw 32-byte key for Ed25519, as RFC 8463 requires.

“Load published record” asks our resolver for the TXT record at the selector you entered and runs the DKIM validator of the Email Security Check. For RSA it reports the exact modulus length read from the key itself, not an estimate from the length of the text.

The tool cannot see whether your mail server actually signs. Send a message to an address you control and look for dkim=pass in the Authentication-Results header, or watch the DMARC reports.