Skip to main content
Protect your domain reputation today
SimpleDMARC

Free DKIM Record Generator

Generate Public and Private Key Pairs for Email Signing

A selector is used to locate the public key in DNS.

What Does This Generator Create?

Our DKIM Record Generator produces two outputs: a private key in PEM format that you install on your mail server or configure in your email service provider, and a public key formatted as a ready-to-publish DNS TXT record. The public key record includes all required DKIM tags — version (v=DKIM1), key type (k=rsa), and the base64-encoded public key (p=). Simply copy the TXT record value and publish it at selector._domainkey.yourdomain.com in your DNS zone, then configure your mail server to sign outgoing messages with the corresponding private key.

Choosing Key Length and Selector

Select 2048-bit RSA for the best balance of security and compatibility — it is the recommended standard and supported by all major DNS providers and email services. 1024-bit is available for legacy compatibility but is considered weak. 4096-bit provides additional security margin but may exceed TXT record size limits at some DNS hosts. For the selector name, use something descriptive and versioned — for example, google2025, mailchimp-prod, or ses-v2. Descriptive selectors make it easy to identify which service uses which key and simplify key rotation when the time comes.

Installing Your DKIM Keys

The installation process depends on your email sending infrastructure. For cloud services like Google Workspace or Microsoft 365, you typically paste the public key into the admin console, and the service handles DNS publication or provides the exact TXT record to add. For self-hosted mail servers (Postfix, Exim, Exchange), install the private key on the server and configure the DKIM signing filter (e.g., OpenDKIM, Rspamd) with the correct selector and domain. After installation, send a test email and use our DKIM Checker to verify the signature validates correctly.

Key Rotation Strategy

Plan to rotate DKIM keys at least once per year. The process is straightforward: generate a new key pair with a new selector (e.g., increment from google2024 to google2025), publish the new selector's TXT record in DNS, wait for DNS propagation, update your sending infrastructure to sign with the new key, confirm the new selector passes our DKIM Checker, and finally remove the old selector from DNS after a grace period (48 to 72 hours to allow in-transit messages signed with the old key to be delivered and verified). This limits the exposure window if a private key is ever compromised.

Frequently Asked Questions

What is DKIM?
DKIM (DomainKeys Identified Mail) uses cryptographic signatures to verify that an email was not altered in transit.
How does this tool work?
This tool generates the correct DNS TXT record format for a DKIM public key. You need to generate the private key on your mail server.
What is a selector?
A selector allows a domain to have multiple DKIM keys. It distinguishes which key is being used for a signature.
How do I keep the private key secure?
Store the private key in a secure location with restricted file permissions. Never share it via email or unencrypted channels. On servers, ensure only the mail signing service has read access to the key file.
Can I use the same DKIM key for multiple domains?
Technically possible but not recommended. Each domain should have its own key pair for proper isolation. If one key is compromised, only that domain is affected.
What format is the private key in?
The private key is output in PEM format (Base64-encoded, wrapped in -----BEGIN RSA PRIVATE KEY----- markers). This is the standard format accepted by most mail servers and email services.
How long does DNS propagation take?
Typically 15 minutes to 48 hours depending on TTL values and DNS provider. We recommend publishing the new key at least 24 hours before switching your sending infrastructure to sign with it.
Free DKIM Key Pair Generator | RSA Public & Private Keys | SimpleDMARC