Skip to main content
InboxkitSign up free

Free tool

DKIM generator

Generate a DKIM key pair for your own mail server. You get the TXT record to publish at selector._domainkey and the private key that signs your mail. The private key is not stored.

Select your email provider for specific instructions

Unique identifier for this DKIM key (letters, numbers, hyphens only)

Advanced Settings

Automate everything

Inboxkit automatically generates and manages DKIM keys with ongoing rotation.

Get Started

Walkthrough

Watch: generate a DKIM key in under a minute

A 42-second walkthrough. On Google Workspace or Microsoft 365 you turn DKIM on in the admin console instead. For your own mail server, enter a selector, keep the 2048-bit key size and generate: you get the TXT record, the selector._domainkey host to publish it at, and the private key to keep secret.

How to use the DKIM generator

  1. Step 1

    Pick your provider

    Choose Google Workspace, Microsoft 365, SendGrid, Mailchimp or Other / Custom. It only changes the setup steps shown with your result.

  2. Step 2

    Enter a selector

    A short name such as s2026 or mail1. Letters, numbers and hyphens only. The record will live at selector._domainkey.

  3. Step 3

    Choose the key size

    Keep 2048 bits. Leave Generate New Key Pair checked, or uncheck it to paste a public key you made yourself.

  4. Step 4

    Generate and save

    Click Generate DKIM Record. Copy the TXT record and host, then copy or download the private key as a .pem file before you leave.

What this DKIM key generator creates

One click returns everything you need to start signing mail with a new key. A 2048-bit record with the default settings looks like this (the key is shortened):

Type:  TXT
Host:  s2026._domainkey
Value: v=DKIM1; h=sha256; s=email; p=MIIBIjANBgkqhkiG9w0BAQEFAAOC...IDAQAB
TTL:   3600

The TXT record

v=DKIM1 marks the record, h=sha256 lists the allowed hash, s=email limits the key to email, and p= holds the public key in base64. Turning on testing mode adds t=y, and anything in Notes is added as n=.

The host name

Built from your selector as selector._domainkey. Your DNS host appends the domain, so receivers look the key up at s2026._domainkey.yourdomain.com.

The private key

An RSA private key in PKCS#8 PEM format (it begins with BEGIN PRIVATE KEY). Show, copy or download it as dkim-private-key-selector.pem, then install it on the server that signs your mail.

Setup steps and warnings

Steps for the provider you picked, plus a warning when the key is under 2048 bits, the record is over 255 characters, the selector is still default, or testing mode is on.

Where the key is generated

The key pair is generated on the Inboxkit server with Node.js crypto, not in your browser. The private key is sent back to you once and is not saved to a database or written to logs, so it is gone once you leave the page or click Generate New.

If your policy says private keys must never leave your machine, make the pair locally, uncheck Generate New Key Pair, and paste only the public key here, without its BEGIN and END lines:

openssl genrsa -out dkim.private 2048
openssl rsa -in dkim.private -pubout

1024 vs 2048-bit DKIM keys

The DKIM standard (RFC 8301) requires keys of at least 1024 bits and recommends 2048. Longer keys make longer records, and a single DNS TXT string holds at most 255 characters, so the size you pick decides how the record has to be stored.

Key sizeRecord lengthDNS storageWhen to use it
1024-bitabout 246 charactersFits in one TXT stringOnly for a DNS host that cannot store long TXT values. Valid, but below the 2048-bit level the DKIM standard recommends.
2048-bitabout 422 charactersTwo strings of up to 255 charactersThe default and the right choice for almost every domain. Google Workspace also uses 2048-bit keys by default.
4096-bitabout 766 charactersFour stringsAllowed by the standard, but some DNS hosts reject records this long. No deliverability benefit over 2048.

Do you need a DKIM generator?

Only if you control the server that signs your mail. Hosted providers keep the private key themselves, so a key you generate elsewhere is never used to sign anything.

Your provider makes the key

  • Google Workspace: Admin console, Apps, Google Workspace, Gmail, Authenticate email. Publish the TXT record it gives you at google._domainkey, then click Start authentication.
  • Microsoft 365: publish the two CNAME records it gives you, selector1._domainkey and selector2._domainkey, then turn on DKIM signing for the domain. Microsoft hosts the keys.
  • SendGrid, Mailchimp and most sending platforms: add the CNAME records from their domain authentication screen.

You need to generate one

  • You run your own MTA: Postfix with OpenDKIM or rspamd, Exim, PowerMTA, Haraka or similar.
  • An SMTP relay or application asks you to upload your own private key.
  • You are rotating the key on such a server and need a new pair under a new selector.

The DKIM setup guide walks through each provider in more detail.

How to publish your DKIM record

  1. Add a TXT record at your DNS host. Name or Host: selector._domainkey (for example s2026._domainkey). Most hosts add the domain for you.
  2. Paste the full value. Everything from v=DKIM1 to the end of the key, on one line, with no quotes unless your host asks for them.
  3. Split it if your host asks. A 2048-bit record is about 422 characters. If the host rejects it, enter it as two quoted strings: "first part" "second part".
  4. Install the private key. Point your signer (for example OpenDKIM's KeyTable) at the .pem file with the same selector and signing domain.
  5. Verify, then send. Wait for the record to resolve, check it, and send a test message before switching live mail to the new key.

Mistakes that break a new DKIM record

  • Typing the full name s2026._domainkey.yourdomain.com where the host already adds the domain, which publishes it at s2026._domainkey.yourdomain.com.yourdomain.com.
  • Pasting the public key with its BEGIN and END lines or line breaks into p=.
  • A selector in DNS that differs from the one the server signs with.
  • Leaving t=y on after testing. Remove it once signatures pass.

Check the new key

Enter your domain and selector in the DKIM checker to confirm the record resolves and the public key parses. From a terminal you can query it directly:

dig TXT s2026._domainkey.yourdomain.com +short

Then send a message to a Gmail address, open Show original and look for DKIM: PASS with your domain. DKIM is one of three records receivers check; once it passes, publish a policy with the DMARC generator and read how SPF, DKIM and DMARC work together.

FAQ

Frequently asked questions

Enter a selector, keep the 2048-bit key size and Generate New Key Pair checked, then click Generate DKIM Record. You get three things: the TXT record value starting with v=DKIM1, the host name to publish it at (selector._domainkey), and the matching private key in PEM format to install on your mail server.

No. The key pair is generated on the Inboxkit server with Node.js crypto, sent back to your browser once, and not saved to a database or written to logs. It is gone when you leave the page or click Generate New, so download the .pem file before you do. If your security policy requires keys made on your own machine, run openssl genrsa -out dkim.private 2048 and paste the public key into the generator instead.

Use 2048-bit. The DKIM standard (RFC 8301) requires at least 1024 bits and recommends 2048, because 1024-bit RSA is now considered weak. The only cost is length: a 2048-bit record is about 422 characters, so it must be stored as two strings, which most DNS hosts handle for you.

No. Google Workspace creates the key in the Admin console (Apps, Google Workspace, Gmail, Authenticate email) and gives you a TXT record for google._domainkey. Microsoft 365 hosts the keys itself and asks you to publish two CNAME records, selector1._domainkey and selector2._domainkey. SendGrid, Mailchimp and most sending platforms also give you their own records. A key you generate elsewhere will not be used by these services, because they sign with a private key only they hold.

When you run the server that signs the mail: Postfix with OpenDKIM or rspamd, Exim, PowerMTA, Haraka or a similar MTA, or an SMTP relay or application that asks you to upload your own private key. You also need a new key pair when you rotate keys on such a server.

Add a TXT record. In the Name or Host field enter selector._domainkey, for example s2026._domainkey, and most DNS hosts add your domain automatically. Paste the whole value starting with v=DKIM1 into the Value field with no line breaks. Set TTL to 3600 or leave the default, save, then install the private key on your mail server with the same selector.

A single DNS TXT string holds at most 255 characters and a 2048-bit DKIM record is about 422. Many DNS hosts split long values automatically. Others, Amazon Route 53 for example, need you to enter the value as two quoted strings side by side. Receivers join the strings back together, so the split point does not matter.

Any short name made of lowercase letters, numbers and hyphens that is not already in use on your domain. Avoid default, because a dated or numbered selector such as s2026 or mail1 makes key rotation simple: publish the new key under a new selector, switch the server over, then remove the old record after a few days.

Once the record is published, enter your domain and selector in the Inboxkit DKIM checker to confirm the record is found and the public key parses. Then send a message from the server to a Gmail address, open Show original, and look for DKIM: PASS with your domain.

Get started

Automate your DKIM setup

Inboxkit automatically generates and manages DKIM keys for maximum email security.