Suped

What is the maximum recommended key length for DKIM?

When setting up DKIM (DomainKeys Identified Mail), one of the most important decisions you'll make is choosing the right key length. This choice is a trade-off between security and compatibility. A longer key is more secure, making it harder for malicious actors to forge your email signature. However, it can also create challenges with some DNS providers.

The two most common key lengths you will encounter are 1024-bit and 2048-bit. For a long time, 1024 bits was the standard, but as computing power has increased, so has the need for stronger encryption.

www.mailjet.com logo
Mailjet says:
Visit website
DKIM keys come in various lengths, with 1024-bit and 2048-bit being the most common. The length of the key impacts how difficult it is for an unauthorized party to break the encryption and forge a signature.
Suped DMARC monitor
Free forever, no credit card required
Get started for free
Trusted by teams securing millions of inboxes
Company logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logo

The case for 2048-bit DKIM keys

Today, the industry best practice is to use 2048-bit keys. A 2048-bit key offers significantly stronger cryptographic protection than a 1024-bit key. As computing technology advances, what was once considered secure can become vulnerable. While 1024-bit keys are not yet widely compromised, the trend is clearly moving towards stronger encryption to stay ahead of potential threats.

www.twilio.com logo
Twilio says:
Visit website
Enter 2048 bit keys. With double the key length, 2048 bit keys provide enhanced tampering protection with the strongest signing for automated email.

Major email providers like Google and Yahoo are increasingly emphasizing strong email authentication. Using a 2048-bit key signals that you take email security seriously, which can positively influence your sender reputation and email deliverability. As Kickbox notes, best practices recommend the longer key length of 2048 for better security.

Potential issues with longer keys

The primary challenge with 2048-bit keys is their length. A DKIM key is published in a TXT record in your DNS. Many DNS providers have a historical limitation on the number of characters that can be placed in a single string within a TXT record, often limited to 255 characters.

postmansmtp.com logo
Post SMTP says:
Visit website
Most DNS providers limit the TXT record field to 255 characters. If your DKIM key is 1024 bits, it should fit comfortably within this limit.

A 1024-bit key typically fits within this limit, but a 2048-bit key does not. This can cause confusion and lead to invalid DKIM records if not handled correctly. Fortunately, there is a standard solution. The DKIM public key can be split into multiple quoted strings within the same TXT record. Most modern email service providers and DNS hosts handle this automatically, but it's something to be aware of if you are manually configuring your records.

What about 4096-bit keys?

If 2048 is good, is 4096 even better? Technically, yes, a 4096-bit key is more secure. The relevant standard, RFC 6376, specifies that verifiers should be able to handle keys up to 4096 bits.

community.mailcow.email logo
mailcow community says:
Visit website
Verifiers MUST be able to validate signatures with keys ranging from 1024 bits to 4096 bits, and they MAY be able to validate signatures with larger keys.

However, in practice, using a key this long can introduce compatibility issues. Not all verifying systems may correctly handle such a large key, even if the standard says they should. The performance overhead and the increased complexity of the DNS record offer diminishing returns for the vast majority of senders. At this time, a 4096-bit key is generally considered overkill.

For a balance of strong security and broad compatibility, 2048 bits is the maximum recommended key length for DKIM today. It provides robust protection against forgery and is supported by all modern email systems.

  • Use 2048-bit keys. This is the current industry standard for strong email security.
  • 1024-bit keys are acceptable but should be upgraded. If you are still using 1024-bit keys, you should plan to rotate to 2048-bit keys.
  • Avoid keys longer than 2048 bits. Keys like 4096 bits may cause deliverability issues and provide little practical benefit over 2048 bits for most senders.

By implementing a 2048-bit DKIM key, you align your domain with current security best practices, strengthening your brand's reputation and helping to protect your recipients from phishing and spoofing attacks.

Start improving your email deliverability today

Get started