DKIM key strength

Short answer

How long should a DKIM key be?

A DKIM key should be RSA of at least 2048 bits. RFC 8301 requires at least 1024 bits, but 1024 is now considered weak and is not recommended. Enter the domain and the selector, and we read the length directly from the public key at selector._domainkey.domain and tell you whether it should be replaced.

Enter the domain and the selector. Without a selector we check the most common ones.

What is strong enough

  • RSA 2048 bit or more: good.
  • RSA 1024 bit: weak, replace the key.
  • Below 1024 bit: not accepted by Gmail and Outlook.
  • Ed25519: strong, but not all receivers support it yet.

How to use the check

  • Enter the domain and the selector from s= in DKIM-Signature.
  • Without a selector we try selector1, selector2, google, default, k1, s1, s2, dkim and mail.
  • For each key you see the type, length, any CNAME and the tags t= and h=.

Why the length is not in the record

The DKIM record has no tag for length. The length is inside the key itself in p=, which is encoded in base64. The check decodes the key and reads the length from there, so the answer is exact.

How to switch to a stronger key

At Microsoft 365, Google and most services you replace the key in the admin panel, and the service creates the new one itself. If you have your own mail server, you create a new key pair with the DKIM generator under a new selector.

Questions and answers

How do I replace the key?

Create a new key with a new selector, publish it, switch the signing, and remove the old one after a week.

Is 4096 bit better than 2048?

It is stronger, but the record gets so long that it must be split, and some DNS services and receivers handle it poorly. 2048 bit is recommended.

What is Ed25519 in DKIM?

A newer key type from RFC 8463 with short and strong keys. Not all receivers support it, so it is used together with an RSA signature.

Does Gmail accept a 1024-bit key?

Yes, but it is considered weak. Switch to 2048 bit when you can.