EmailAudit.io

DKIM Record Generator

Format your DKIM public key as a correctly structured DNS TXT record. Enter your selector, domain, and the public key provided by your email platform.

Where does the public key come from? Your email provider generates the DKIM key pair and gives you the public key to publish in DNS. In Google Workspace, go to Admin Console → Apps → Google Workspace → Gmail → Authenticate email. In Microsoft 365, go to Security → Email & collaboration → Policies → DKIM.

Paste the public key value here to generate the correctly formatted DNS record.

The selector is a prefix for the DNS record name. It is chosen by you or provided by your email platform.

Your root domain (e.g. yourdomain.com).

Paste the public key value from your email provider. PEM headers (-----BEGIN PUBLIC KEY-----) are stripped automatically.

Generated RecordFill in all fields above
DNS Record Name
[selector]._domainkey.[yourdomain.com]
DNS Record Value
v=DKIM1; k=rsa; p=[your-public-key]

DNS Instructions

  • • Record type: TXT
  • • Host / Name: [selector]._domainkey
  • • TTL: 3600 (1 hour)
  • • The DNS value must be a single continuous string — no line breaks in the key.
Verify with DKIM Validator

What this generator does, and what it does not

The generator takes a selector, a domain, a key type and a public key, and formats them into the two things your DNS provider asks for: the record name (selector._domainkey.yourdomain.com) and the TXT value (v=DKIM1; k=rsa; p=...). It strips PEM headers and all whitespace from the pasted key so the value is one continuous string.

It does not create a key pair. The private key must be generated by the system that signs your mail, which is normally your mail platform, or by you with a tool such as OpenSSL if you run your own mail server. Only the public key goes into DNS. Never paste a private key into any web form.

The record, tag by tag

Example output

Name:  google._domainkey.example.com
Type:  TXT
Value: v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA...IDAQAB
TagMeaningNotes
v=DKIM1Record version.Optional by the spec but always include it. The generator always does.
k=Key type: rsa or ed25519.rsa is assumed if omitted.
p=The base64 public key.Empty p= means the key is revoked.
t=yTesting mode.Not output by the generator. Do not add it to production records.
t=sStrict domain matching: the signing domain must match exactly, with no subdomains.Not output by the generator. Add it manually if you need it.
h=, s=, n=Allowed hash algorithms, allowed service types, and a human-readable note.Optional and rarely needed. Add manually if required.

Step by step: publish a DKIM record

  1. Generate the key in your mail platform (see the provider notes below) or with OpenSSL, and note the selector name the platform gives you.
  2. Paste the public key into the generator. A full PEM block is fine; the BEGIN and END lines are removed automatically.
  3. Enter the selector and your domain, then choose the key type that matches how the key was generated.
  4. In your DNS provider, add a TXT record with the host set to selector._domainkey. Most providers append the domain automatically, so do not type it twice.
  5. Paste the value as one string. If your provider splits long values into several quoted chunks, that is normal and valid, since a single DNS string is limited to 255 characters and a 2048-bit key is longer than that.
  6. Wait for the TTL, then confirm with the DKIM checker using your selector, and only then switch on signing in your platform.

Generating your own key with OpenSSL

Only needed if you run your own mail server or signing software. Keep private.pem on the server and publish only the second command's output as the p= value.

2048-bit RSA key pair

openssl genrsa -out private.pem 2048
openssl rsa -in private.pem -pubout -outform der | openssl base64 -A

For Ed25519, p= must be the raw 32-byte public key in base64 (44 characters), as defined in RFC 8463, not the longer DER wrapper that OpenSSL prints by default. Because not every receiver verifies Ed25519 signatures, the usual approach is to sign with both an RSA and an Ed25519 key under different selectors. If you are unsure, use RSA.

Provider notes

ProviderHow DKIM is publishedWhat to know
Google WorkspaceTXT record at google._domainkey (default selector google).Generate it in Admin console, Apps, Google Workspace, Gmail, Authenticate email. Choose 2048-bit if offered. Publish the TXT with this generator, then click Start authentication.
Microsoft 365Two CNAME records, selector1._domainkey and selector2._domainkey, pointing to your onmicrosoft.com tenant.Microsoft hosts the keys, so this generator is not used. Add the CNAMEs, then enable signing in the Microsoft Defender portal under email authentication settings.
Amazon SESThree CNAME records with random token names (Easy DKIM).CNAME-based, so not generated here. The selectors are random, so the checker needs the selector from a message header.
SendGrid, Mailchimp, HubSpotCNAME records shown in each platform's authentication or domain setup page.Add the records exactly as displayed. Use this generator only when a platform gives you a raw public key to publish as TXT.
Your own server or relayTXT record you create.This is the main use case for the generator.

Rule of thumb: if the platform tells you to add a CNAME, add the CNAME. If it gives you a long p= key, this generator formats it as TXT.

Troubleshooting a record that does not verify

  • Key pasted with line breaks or extra spaces: the generator removes them, but a value edited by hand afterwards may break again.
  • Selector or domain typo: the record name must match the s= and d= values in the DKIM-Signature header exactly.
  • Host entered with the domain duplicated, for example google._domainkey.example.com.example.com: check how your DNS provider treats the host field.
  • RSA key published as ed25519, or the reverse: k= must match the key that was actually generated.
  • Signing enabled before the record propagated: wait for the TTL and re-check before enabling.

Limitations of this generator

  • It does not validate the key. Pasting random text still produces a record that looks complete. Verify with the DKIM checker.
  • It only writes v, k and p tags. Flags such as t=s and tags like h= and n= must be added by hand.
  • It does not generate or store keys, and it does not talk to your mail platform.
  • The domain field is used as typed. If your platform signs as a subdomain, use that subdomain.
  • Publishing the record is only half of DKIM. The platform must be signing outgoing mail with the matching private key.

Related tools and guides

Frequently Asked Questions

What is a DKIM record and what does it do?

A DKIM (DomainKeys Identified Mail) record is a DNS TXT record that stores the public key used to verify email signatures. When your email server sends a message, it adds a cryptographic signature using the private key. Receiving servers look up your DKIM record to get the matching public key and verify the signature — confirming the email was not altered in transit and genuinely came from your domain.

Where do I get my DKIM public key?

Your email provider generates the DKIM key pair and gives you the public key to publish. In Google Workspace, go to Admin Console → Apps → Google Workspace → Gmail → Authenticate email, then generate a new key. In Microsoft 365, go to Security → Email & collaboration → Policies & rules → Threat policies → DKIM. For other providers, check their DKIM setup documentation — they will provide the exact DNS record to add.

What is a DKIM selector?

A DKIM selector is a prefix added to the DKIM record name in DNS. It allows a domain to have multiple DKIM keys (for different sending services or key rotation). The selector is included in the email signature header so receiving servers know which DNS record to look up. Common selectors include google, mail, selector1, selector2, and dkim. The full DNS record name is [selector]._domainkey.[yourdomain.com].

Should I use RSA or Ed25519 for DKIM?

RSA is the most widely supported DKIM key type and should be used in most cases. Use RSA-2048 for the best balance of security and compatibility. Ed25519 is smaller and more efficient but not yet supported by all email platforms. Unless your provider specifically generates Ed25519 keys, use RSA.

How do I know if my DKIM record is working?

After publishing the DKIM record in DNS, allow up to 48 hours for propagation, then use a DKIM validator to check it. Send a test email to a Gmail or Outlook account and view the email headers — look for Authentication-Results showing dkim=pass. You can also run a Full Audit to check all authentication records at once.