How do I generate a DKIM key?
Pick a selector, key type, and record options, then generate. Publish only the TXT public key at selector._domainkey and install the private key on the signer. If Google, Microsoft, Klaviyo, or SendGrid send for you, use their wizard instead. They already hold the private key.
What selector should I use?
Anything unique on the domain: s1, google, selector1, or a date like 20260903. It must match the s= tag in the DKIM-Signature header. Do not overwrite a selector you are already signing with until the mail server has switched.
RSA or Ed25519?
RSA 2048-bit is the safe default and what most ESPs and inbox providers expect. Ed25519 (RFC 8463) makes a short TXT and a strong key, but plenty of signers and some receivers still do not support it. Use Ed25519 only if you know the MTA will sign with it.
What do h=, s=, t=, and n= mean?
h= lists hash algorithms the key may use (sha256, optionally sha1). s=email limits the key to email. t=y is testing mode. t=s means the key is not valid for subdomains. n= is a human note in the record. All of those except p= are optional.
Can I paste an existing public key?
Yes. Turn off key generation and paste a PEM or the raw p= Base64. The tool will wrap it in a DKIM TXT with the tags you chose. It will not invent a private key for a public key you already have.
Where does the private key go?
On the mail server or ESP that will sign outgoing mail. Never in DNS. Never in a public ticket. If it leaks, generate a new pair on a new selector and revoke the old one with an empty p=.
Why is the TXT longer than 255 characters?
A 2048-bit RSA public key does not fit in one DNS character-string. It is still one TXT record, split into quoted chunks. Cloudflare usually wraps a single paste. Bind-style zones need the split or the zone snippet.
Does generating a key publish it or start signing?
No. This creates a record in memory. You still paste the TXT, configure the signer, and check a real message for dkim=pass.