Skip to content
AdminKit
Free tool Updated

DKIM record generator: how do you build a selector._domainkey TXT record?

How does this check work, and what does the result tell you?

AdminKit's DKIM record generator formats the exact selector._domainkey.<domain> TXT record — v=DKIM1, k=, p= and optional t=/h=/s=/n= tags — from a PUBLIC key you already have, entirely in your browser. It never generates a key pair or sees a private key; publish the result in DNS and confirm it with AdminKit's live DKIM check.

Part of the Email authentication cluster — more tools, guides and terms on email authentication.

Paste a PUBLIC key only — never a private key. This tool never generates a keypair and never sees, stores or transmits a private key; it only formats the DNS record text from the public key you already have.

The label your mail provider assigned to this key, e.g. default, s1, google.

The domain this selector's key will be published under.

Optional. Leave blank to omit, or set * / email.

Paste the output of `openssl rsa -pubout` (or equivalent) — PEM headers and newlines are stripped automatically. Leave blank to build a deliberately revoked (empty p=) record.

Flags (t=)
Acceptable hash algorithms (h=)

Leave both unchecked to omit h= and accept any hash algorithm.

Optional, human-readable only — not interpreted by verifiers.

  • A selector is required.
  • A domain is required.

What the result means

This is the record text built from the selector, domain and PUBLIC key you entered — it says nothing about what your domain currently publishes, and it never saw, generated or stored a private key. To see what is actually live in DNS today, run AdminKit's DKIM check.

Next step

If you don't have a key pair yet, generate one offline with openssl genrsa -out private.pem 2048 followed by openssl rsa -in private.pem -pubout -out public.pem, then paste the contents of public.pem above — keep private.pem on your mail server only, never in DNS or anywhere else. Publish the record above as a TXT record at the host shown, then confirm it with the live DKIM check once DNS has propagated.

Keep this result

Copy a link to this check so you can share it or run it again later. Want a heads-up when this result changes? Talk to our team and we'll set it up for you.

How it works and limits

Paste the selector, domain and the PUBLIC key you already have below, and this tool assembles the exact selector._domainkey.<domain> TXT record string as you type, entirely in your browser — nothing you enter, including the key itself, is sent to AdminKit or anywhere else. It only formats a record from a key you provide: it never generates a key pair and never handles a private key. Once you are happy with the result, publish it in your DNS, then confirm it took effect with AdminKit’s live DKIM check, which queries DNS for real.

What does a DKIM record actually need?

DKIM, defined in RFC 6376, publishes a signing key as a TXT record at selector._domainkey.<domain>. Its tags, registered in IANA’s DKIM-Signature Tag Specifications, are:

  • v=DKIM1 — the fixed version tag, always first.
  • k= — the key algorithm: rsa (the near-universal default) or ed25519.
  • p= — required, the base64-encoded public key. An empty value is a deliberate revocation (see the FAQ below).
  • h= — optional, the colon-separated hash algorithms a verifier may accept (sha1, sha256); omitted, any algorithm is acceptable.
  • s= — optional, the colon-separated service types this key applies to, e.g. email.
  • t= — optional, colon-separated flags: y marks the selector “testing,” s restricts signing to exactly this domain, not its subdomains.
  • n= — optional, a human-readable note for administrators; verifiers never interpret it.

Why do you need a selector, and what happens with an empty key?

A domain can publish many DKIM keys at once, one per sending service, each under its own selector label — RFC 6376 §3.1 defines no DNS record that lists a domain’s active selectors, so the selector has to come from whoever configured mail sending (usually shown in that provider’s admin panel). If you can’t find it there, Google’s Workspace guide to setting up DKIM suggests sending yourself a test message and reading the s= value in its DKIM-Signature header, which is the selector that message was signed with. Leaving the public key field blank here builds a record with an empty p=, which RFC 6376 §3.6.1 defines as a deliberately revoked key, not a broken one — the expected way to retire a selector when rotating keys.

How to read the results

The output updates as you type.

  • TXT record for <selector>._domainkey.<domain> — the host name to publish under, then the record text: v=DKIM1, then h= if you ticked a hash algorithm, k=, n=, s= and t= if set, and p= last with your key stripped of PEM headers and line breaks. Copy record copies the unquoted text.
  • Split into quoted strings — shown only when the record is longer than 255 characters, which a 2048-bit RSA key always is. Each quoted string is at most 255 characters; Copy split form copies them for a zone file or a DNS provider that doesn’t split long TXT values itself.
  • Warnings (amber) — the record is still built, but p= is empty (a revoked key), or the record is over 255 characters and needs the split form.
  • Errors (red, no record shown) — the selector or domain is missing or invalid, or the key isn’t valid base64 once PEM headers are removed.

Examples

MIIBIjANBgkq… stands for the base64 body of a 2048-bit RSA public key in PEM form (392 characters).

InputOutputWhat it means
selector s1, example.com, RSA public key PEMv=DKIM1; k=rsa; p=MIIBIjANBgkq… (410 characters) at s1._domainkey.example.com, plus the split form and a length warningNormal record; publish it as one TXT value or as the 2 quoted strings.
same, with t=y and h=sha256 tickedv=DKIM1; h=sha256; k=rsa; t=y; p=MIIBIjANBgkq…Testing flag set and only SHA-256 accepted; remove t=y once signing works.
selector ed1, example.org, Ed25519 key 11qYAYKxCrfVS/7TyWQHOg7hcvPapiMlrwIaaPcHURo=v=DKIM1; k=ed25519; p=11qYAYKxCrfVS/7TyWQHOg7hcvPapiMlrwIaaPcHURo= (66 characters, no split)An Ed25519 key (this one is RFC 8463’s example key) fits in one string.
selector old2023, example.net, key left blankv=DKIM1; k=rsa; p= + revoked-key warningPublishing this retires the selector on purpose.
key with a stray $ in itError, no recordThe key isn’t valid base64; copy it again without extra characters.

Limits

  • This tool only builds the record text from a public key you provide. It never generates a key pair, never sees or stores a private key, never queries DNS, and never publishes anything — you still have to add the record to your own DNS and confirm it with a live check.
  • It validates the selector and domain syntax and strips PEM armor down to raw base64 for p=, but it does not parse the key’s actual cryptographic contents or confirm it is really an RSA or Ed25519 public key — for that, inspect the key with openssl rsa -pubin -text -noout (or the equivalent for Ed25519) before pasting it in.
  • If you already have a long DKIM key or any other TXT value from elsewhere and just need it reformatted into <=255-octet quoted strings, AdminKit’s TXT record splitter does that split on its own, without the selector/domain fields this generator asks for.

If you don’t have a key pair yet, generate one offline with OpenSSL — see openssl-rsa(1) for the full -pubout option this tool’s “next step” panel above walks through — and keep the private key file on your mail server only. See SPF, DKIM and DMARC explained for how DKIM fits together with the other two mail authentication records, and AdminKit’s live DKIM check and SPF check once your records are published.

If you would rather have a tool that creates the key pair for you, or want to see how other free generators differ, see best free DKIM record generators, which ranks AdminKit’s own generator on the same criteria against others.

Frequently asked questions

Why does this tool ask for a selector instead of just a domain?

Because DKIM publishes one key per selector, not per domain: RFC 6376 subdivides "the key namespace ... using 'selectors'" (RFC 6376 §3.1), resolving to a DNS name of the form selector._domainkey.domain. A domain can run several selectors at once — one per sending service, rotated over time — so this tool needs the selector to build the right host name, the same selector value AdminKit's live DKIM check asks for.

What's the difference between pasting a public key here and a private key?

A public key is what this tool formats into p= so receivers can verify your mail's signature; a private key is what your mail server uses to create that signature and must never leave it. This tool only ever reads the text you paste to build a record string in your browser — it has no way to tell a pasted private key from a public one, so the responsibility not to paste one is on you, which is why the form displays an explicit public-key-only warning.

Why does the tool split my record into multiple quoted strings?

A DNS TXT record is made of one or more <character-string>s, each limited to 255 octets by RFC 1035 §3.3.14, and an RSA public key's base64 text routinely exceeds that on its own. RFC 6376 §3.6.1 requires a key record longer than 255 characters to be presented as several back-to-back quoted strings, which concatenate into the original value once the record is parsed — most DNS providers' UI does this automatically, but the split form is what to paste into a zone file or a provider that doesn't.

I generated a record with an empty p= — is that a mistake?

No — RFC 6376 states plainly that "an empty value means that this public key has been revoked" (RFC 6376 §3.6.1), which is the expected way to retire a selector when rotating keys or decommissioning a mail-sending service. Leaving the field blank here builds exactly that record on purpose; this tool warns about it so you don't publish it by accident.

Where exactly do I publish the generated record?

As a TXT record at the host name the tool shows above the record, <selector>._domainkey.<domain>, for example s1._domainkey.example.com. Many DNS providers' forms append your domain to the name automatically; in that case enter only s1._domainkey, or the record ends up at s1._domainkey.example.com.example.com. AdminKit's DKIM check then shows whether the record is live.