Email authentication error
DKIM key too long for DNS TXT: splitting a 2048 bit key correctly
A 2048 bit DKIM public key is about 410 characters once the record is written out, and a single string inside a DNS TXT record can hold only 255 characters. So the key has to be published as two or more quoted strings in the same record, which receivers join back together. When a domain host rejects the long value, silently cuts it off, or splits it in the wrong place, DKIM verification fails with a message such as "key not found", "public key invalid" or "bad signature".
By Kyle Deligny, Titanos, Brisbane. Last reviewed 1 December 2026. General information, not legal advice.
This page covers why the limit exists, how to split the key safely, the quirks that catch people at different DNS hosts, and how to confirm the record you published is the record the world sees.
Why 2048 bit keys do not fit in one string
DNS stores a TXT record as one or more character strings, and each string is limited to 255 bytes by the original DNS specification (RFC 1035). A DKIM record carries the tags v=DKIM1, k=rsa and p=, then the public key in base64. A 1024 bit RSA key encodes to roughly 216 base64 characters, so the whole record is around 235 characters and fits in one string. A 2048 bit key encodes to roughly 392 characters, which pushes the record to about 410 and over the limit.
This is a limit on each string, not on the record. RFC 7208 section 3.3 says multi string records are useful for building values that would exceed the 255 octet limit, and RFC 6376 section 3.6.2.2 says that the strings in a DKIM key record "MUST be concatenated together before use with no intervening whitespace". A receiver therefore sees one continuous value, as long as nothing was added between the pieces.
Why you want the longer key anyway
RFC 6376 requires signers to use RSA keys of at least 1024 bits, and verifiers must accept keys from 512 to 2048 bits. Google's sender guidance asks for a DKIM key of at least 1024 bits for mail to personal Gmail accounts and recommends 2048. Google Workspace's own setup page tells you to choose a 2048 bit key if your domain host supports it, and a 1024 bit key if it does not.
So a 1024 bit key is acceptable today, and falling back to it is a reasonable way to get unstuck. The longer key is the better long term choice, which is why it is worth learning to publish it properly rather than avoiding it.
How to split the key
Take the full value your mail provider gave you, beginning v=DKIM1 and ending with the last character of the key. Break it into pieces of 255 characters or fewer, wrap each piece in its own double quotes, and place the pieces one after another in the same TXT record, separated by a single space or nothing at all. Where you cut does not matter, because the pieces are rejoined, but you must never cut in a way that adds or removes a character.
The record name is the selector, then _domainkey, then your domain, for example selector1._domainkey.yourbusiness.com.au. Keep exactly one record at that name. Two TXT records at the same selector name make the result unpredictable.
Quirks at domain hosts and registrars
Hosts differ in what their form expects, and the form usually gives no feedback until mail fails. These are the behaviours to look for rather than a list of named products, since interfaces change often:
- Some hosts split long values for you, so pasting the whole key with no quotes works. If you also add quotes by hand you can end up with literal quote characters inside the key.
- Some hosts need you to add the quotes and the split yourself, and they may save a long single string without complaint but publish only the first 255 characters.
- Some hosts wrap the pasted value across lines in the form and insert a space or a line break, which corrupts the base64.
- Some hosts append your domain to the record name automatically, so typing the full name publishes selector1._domainkey.yourbusiness.com.au.yourbusiness.com.au.
- Some mail providers publish the key as a CNAME to their own server instead of a TXT value. Then there is nothing to split.
Checking what the world actually sees
Query the selector name as a TXT record using a command line tool or a web based DNS lookup, and read the answer as one value. It should start v=DKIM1 and end with the last characters of the key, with no stray quote marks, spaces or line breaks in the middle. A lookup tool that shows two quoted strings is fine, since that is how a split record is displayed.
Then send a real message to a mailbox you control and read its Authentication-Results header. You want dkim=pass with d= set to your own domain. A pass that shows the mail provider's domain instead means the message was signed with their key, not yours, which does not help your DMARC alignment. Our DMARC generator explains how alignment is tested once DKIM is passing.
Publish a 2048 bit DKIM key without breaking it
- Generate the key in your mail platform and copy the full value from v=DKIM1 to the final character.
- Confirm whether the provider wants a TXT record or a CNAME, because the steps differ.
- Create one TXT record named selector._domainkey with no domain appended twice.
- If the host does not split for you, cut the value into pieces of 255 characters or fewer and quote each piece.
- Remove any stray spaces or line breaks that the form added inside the key.
- Save, wait for the host's stated propagation time, then look up the TXT record and read it as one value.
- Switch signing on in the mail platform only after the lookup matches the key you were given.
- Send a test to a personal mailbox and confirm dkim=pass with your own domain in d=.
- If the host will not accept the long key, publish a 1024 bit key for now and move host or plan later.
Questions people ask
Can I just use a 1024 bit key to avoid the problem?
Yes. RFC 6376 sets 1024 bits as the minimum for signers, and Google accepts 1024 bit keys for mail to Gmail while recommending 2048. Use 2048 once your DNS host can publish it, because longer keys are harder to break.
Where should I cut the key when splitting it?
Anywhere. The receiving server joins the strings with nothing in between, so the cut point has no meaning. What matters is that no string is over 255 characters and no character is added or lost.
Why does my DNS host show the record as two strings?
That is how a long TXT value is stored and displayed. Two quoted strings in one record is normal and is read as one continuous key.
My lookup shows the key but DKIM still fails. What else could it be?
Check the selector name matches the s= tag in the message header, that signing is switched on, and that you published only one record at that name. A key that was edited after the platform generated it will also fail.
Where to from here
The free privacy policy audit reads your published privacy policy against the Australian Privacy Principles and tells you what is missing. Privacy Care keeps your policy and your shopper data practices current for AU$149 a month, with a 3-month minimum. Would it be okay if we showed you what the audit finds? A no is welcome.
Sources
- RFC 6376, DKIM Signatures, section 3.6.2.2 and key sizes
- RFC 1035, Domain Names Implementation, character strings
- RFC 7208, SPF, section 3.3 on multiple strings
- Google, email sender guidelines
- ASD, how to combat fake emails
General information, not legal advice. Laws and guidance change: check the linked primary sources and ask a qualified adviser about your own situation. Written by Kyle Deligny with AI assistance, last reviewed 1 December 2026. How we write and check: editorial policy.
