OquMail
Loading account…
DNS & Setup9 min read

How to Split a DKIM Record: 255-Character Fix per DNS Host

How to split a DKIM record over 255 characters: the TXT string rule, exact steps for Cloudflare, Route 53, GoDaddy, Namecheap and BIND, and how to check.

To split a DKIM record, keep it as one TXT records (short text lines in DNS used for email security) and break the value into two or more quoted strings of up to 255 characters each, like "v=DKIM1; k=rsa; p=MIIB...first part" "...second part". Resolvers join the strings back together with nothing in between. The hard part is knowing whether your DNS host wants you to do this by hand: Cloudflare, GoDaddy and Namecheap split long values for you, while Amazon Route 53 and BIND zone files expect the quotes. Here is the rule, the exact steps for each host, and how to prove the result is correct.

Quick answer

A 2048-bit DKIM value is 410 characters long, and one DNS text string holds at most 255. The fix is not two records. It is one TXT records (short text lines in DNS used for email security) whose value contains two strings, each in double quotes, separated by a space. On Cloudflare, GoDaddy and Namecheap, paste the full value with no quotes and the panel does the split. On Route 53, type the quoted strings yourself on a single line. In a BIND zone file, wrap the strings in parentheses. Then look the record up with dig or nslookup and confirm the joined value matches what your email provider shows.

Why a DKIM key does not fit in 255 characters

DNS stores TXT data as character-strings, and RFC 1035 gives each string a single length byte, so no string can be longer than 255 characters. A DKIM record carries an RSA public key written in base64 after the prefix v=DKIM1; k=rsa; p= and its size is fixed by the key length:

  • 1024-bit key: 216 characters of key, 234 with the prefix. Fits in one string, which is why older setups never hit the problem.
  • 2048-bit key: 392 characters of key, 410 in total. Needs two strings. This is the size most providers issue today, including OquMail for every domain.
  • 4096-bit key: 736 characters of key, 754 in total. Needs three strings, and some DNS hosts reject it outright.

The rule that makes splitting safe

RFC 6376, the DKIM standard, says: "Strings in a TXT RR MUST be concatenated together before use with no intervening whitespace." SPF has the same rule in RFC 7208. Two things follow from it. First, it does not matter where you cut; the middle of the key is fine, because the receiving server glues the pieces back exactly. Second, the split has to stay inside one record. The same standard says that if a selector has more than one TXT records (short text lines in DNS used for email security), the results are undefined, which in practice means the signature check fails.

How to split the value by hand

Copy the full value from your provider, cut it into pieces of 255 characters or fewer, put each piece in double quotes, and place the pieces one after another with a single space between them. Pieces of 250 are a good habit because nothing sits near the limit. On a Mac, on Linux, or in Git Bash on Windows, these two lines do the counting for you; the output is ready to paste into a field that wants quoted strings:

VALUE='v=DKIM1; k=rsa; p=PASTE_THE_FULL_KEY_HERE'
echo -n "$VALUE" | fold -w 250 | sed 's/.*/"&"/' | tr '\n' ' '

# Result for a 2048-bit key: two quoted strings, 250 and 160 characters
"v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA...(250)" "...(160)...IDAQAB"

Step by step for each DNS host

Cloudflare

Go to DNS, then Records, then Add record. Choose type TXT, enter oqumail._domainkey as the name (Cloudflare adds your domain), and paste the whole value into Content without quotes. Cloudflare's documentation says it adds the double quotes itself when you leave them out, and it stores a long value as several strings: look up a 2048-bit key on a Cloudflare-hosted domain and it comes back as a 255-character string followed by the rest. TXT records have no proxy setting, so the orange cloud does not come into it. If your domain is on Cloudflare, OquMail can also connect to your Cloudflare account and add all five records for you; the Cloudflare email DNS guide shows both routes.

Amazon Route 53

Open Hosted zones, choose the domain and click Create record. Enter oqumail._domainkey as the record name, choose TXT, and in Value type the split strings in quotes on one line, separated by a space. AWS's documentation says a single string can hold up to 255 characters, that longer values must be broken into quoted strings listed on the same line, and that a whole TXT value can be up to 4,000 characters. Watch the trap: Route 53 treats every line in the Value box as a separate value, so putting the two halves on two lines creates two TXT records and breaks DKIM. The Route 53 email DNS guide covers the other mail records.

Record name:  oqumail._domainkey
Record type:  TXT
Value:        "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG...first 250 characters" "...remaining 160 characters...IDAQAB"

GoDaddy

Open the domain in your Domain Portfolio, go to DNS and add a new record of type TXT. Use oqumail._domainkey as the Name and paste the full value without quotes. GoDaddy's help page says the Value field accepts up to 1,024 ASCII characters, which is plenty for a 2048-bit key in one piece. Look the record up afterwards and it comes back as a 255-character string followed by a 155-character one: GoDaddy has split it for you, so do not add quotes of your own on top.

Namecheap

In Domain List choose Manage, open Advanced DNS, click Add New Record and pick TXT records (short text lines in DNS used for email security). Host is oqumail._domainkey and Value is the full key pasted in one piece. Namecheap's published DNS limits allow up to 2,500 characters in a TXT value, and the split into strings happens on its side. Check first that the domain uses Namecheap's own nameservers (BasicDNS); if they point somewhere else, records added in Advanced DNS do nothing.

DigitalOcean

Under Networking, then Domains, choose the domain and the TXT tab. Hostname is oqumail._domainkey and Value is the DKIM value. DigitalOcean's documentation does not say how it stores values over 255 characters, and users have reported the panel refusing long DKIM keys. Paste the whole value first and check the result with dig. If the panel rejects it, or the lookup comes back shorter than 410 characters, delete the record and enter the value as quoted strings in the same Value box.

BIND and other zone files

In a zone file, parentheses let one record run over several lines, and each quoted piece becomes one string. Keep all the pieces inside a single TXT records (short text lines in DNS used for email security), check the file with named-checkzone, raise the SOA serial number and reload the zone.

$ORIGIN example.com.
oqumail._domainkey  3600  IN  TXT  ( "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA..."
                                     "...rest of the key, up to 255 characters per line...IDAQAB" )

Panels that cap the value at 255 characters

Some registrar and web-hosting control panels still refuse anything over 255 characters in the value box, or quietly cut it off at 255. Try the quoted-strings form in the single field first, because some of these panels accept it. If that fails, ask support whether long TXT records are possible; Google's own DKIM help suggests the same question and offers its customers a 1024-bit key as a fallback. OquMail issues 2048-bit keys only, so the dependable fix is to move DNS hosting to a provider that handles long values, such as Cloudflare's free plan, by changing the domain's nameservers. The domain stays registered where it is.

Free business email on your own domain

OquMail gives you up to 15 mailboxes on your domain — free — with guided SPF/DKIM/DMARC, webmail, IMAP/SMTP for any mail app, and a send API. Setup is a few DNS records; changes usually take effect within minutes, occasionally up to 48 hours. Start at oqumail.com.

Get started free

The five DNS records OquMail needs

OquMail's DKIM selector is oqumail, so the record's host is oqumail._domainkey and its full name is oqumail._domainkey.yourdomain.com. The dashboard shows the complete value with a copy button, and it is always 410 characters. Our guide to what a DKIM selector is explains the naming.

  • Ownership (TXT at @) — oqumail-verification=… (your own token is shown in the OquMail dashboard; it proves the domain is yours)
  • MX — host @, value mail.oqumail.com, priority 10
  • SPF (TXT at @) — v=spf1 MX (Mail Exchanger — where incoming email is delivered) a:mail.oqumail.com ~all
  • DKIM (TXT at your selector ._domainkey) — v=DKIM1; k=rsa; p=… (the exact key is shown in your OquMail dashboard)
  • DMARC (TXT at _dmarc) — v=DMARC1; p=none; rua=mailto:dmarc@yourdomain.com

How to check the record

Check with a public resolver rather than trusting the panel. A correctly split record comes back as one answer holding two quoted strings next to each other. That is normal and is not two records. To be sure nothing was cut off, join the strings and count the characters: an OquMail DKIM value should come to exactly 410.

# macOS or Linux
dig +short TXT oqumail._domainkey.example.com
"v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA..." "...wIDAQAB"

dig +short TXT oqumail._domainkey.example.com | sed 's/" "//g; s/"//g' | tr -d '\n' | wc -c
410

# Windows
nslookup -type=TXT oqumail._domainkey.example.com 1.1.1.1
((Resolve-DnsName oqumail._domainkey.example.com -Type TXT).Strings -join '').Length

When the lookup is right, click Verify on the domain in OquMail; the check reads the record the same way a receiving server does. If the record verifies but receivers still report dkim=fail in the message headers, the problem is somewhere else, usually a message changed in transit, and our guide to fixing a DKIM signature that did not verify walks through the causes.

Common mistakes when splitting DKIM

  • Two TXT records instead of one. Saving each half as its own record gives two answers at the selector. The DKIM standard calls that undefined, and receivers fail the check.
  • A space added inside the value. The strings are joined with nothing between them, so a space typed at the cut point stays in the key. The DKIM standard does let verifiers skip spaces inside the p= key, but not every checker is that forgiving, and a space inside v=DKIM1 or k=rsa breaks the record outright.
  • Quotes pasted into a panel that adds its own. On GoDaddy or Namecheap the quote marks can be stored as part of the text, and the lookup then shows backslash-quote characters. Paste plain text unless the panel asks for quotes.
  • The domain added twice to the host. Panels that append your domain turn oqumail._domainkey.example.com into oqumail._domainkey.example.com.example.com. Enter only oqumail._domainkey.
  • A CNAME where a TXT belongs. Some providers, Microsoft 365 among them, publish DKIM as a CNAME pointing at a key they host. OquMail's DKIM is a TXT records (short text lines in DNS used for email security) holding the key itself, and an old CNAME at the same name blocks it, because DNS does not allow a CNAME alongside other records with the same name.
  • A truncated copy. A 2048-bit key in this format always ends in IDAQAB. If yours ends in anything else, part of it was lost when copying.

Common questions

What is the maximum length of a DKIM TXT record?

Each string inside a TXT records (short text lines in DNS used for email security) is limited to 255 characters, but one record can hold several strings. The practical ceiling is set by your DNS host: Route 53 allows 4,000 characters per value, Namecheap 2,500, GoDaddy 1,024, and Cloudflare caps any record at 4,096 bytes on the wire. All of them sit well above the 410 characters of a 2048-bit DKIM value.

Should I split a DKIM record into two TXT records?

No. Split the value into two strings inside one TXT records (short text lines in DNS used for email security). Two separate records at the same selector make the result undefined, and most receivers treat that as a failure.

Does it matter where I split the DKIM key?

No. Any cut point works as long as every piece is 255 characters or fewer and you add no characters of your own. Receivers join the pieces with nothing in between.

Why does my DKIM record show up in two parts?

Because it is stored as two strings, which is exactly what a split record looks like. dig shows the strings side by side in quotes, nslookup on Windows shows them on separate lines. Both are one record.

Can I use a 1024-bit DKIM key instead?

A 1024-bit value is 234 characters and fits in one string, but 2048 bits is the recommended size today and OquMail issues 2048-bit keys only. If your DNS host cannot store a long value, moving DNS to a host that can is a better fix than a weaker key.

Want to see how your own domain is set up? Use the free SPF checker and MX lookup: they run in your browser and store nothing.