SPF record too long: the 255-character string limit and 512-byte advice
Updated 10 November 2026 · 4 min read
Short answer
One DNS TXT string can hold at most 255 characters, so an SPF record longer than that must be published as several quoted strings in the same record, which receivers join with no space: "v=spf1 ip4:… include:…" "include:… ~all". Separately, RFC 7208 advises keeping the SPF answer small enough to fit in a 512-byte DNS response. If your record is that long, the real fix is fewer senders or a subdomain, not clever splitting.
Splitting correctly
Too long for one string (290 characters):
v=spf1 ip4:198.51.100.0/24 ip4:203.0.113.0/24 ... include:_spf.google.com ~all
Published as one record with two strings:
"v=spf1 ip4:198.51.100.0/24 ip4:203.0.113.0/24 ... " "include:_spf.google.com ~all"- Receivers concatenate the strings with no separator, so put the space inside a string (end of the first or start of the second), or two terms merge into one invalid term.
- It is still one record. Two separate TXT records that each start
v=spf1would be the multiple-records error instead. - Many panels (Cloudflare, GoDaddy) split long values automatically; Route 53 makes you type the quotes yourself.
Why size matters beyond 255
RFC 7208 section 3.4 notes that DNS answers over 512 bytes may need TCP or EDNS, which some resolvers handle badly, and advises keeping SPF records small. A record that lists dozens of ip4: ranges also tends to sit next to many includes, which runs into the 10-lookup limit anyway.
Making the record shorter
| Technique | Effect |
|---|---|
| Use CIDR ranges instead of single IPs | ip4:203.0.113.0/28 replaces 16 single addresses |
Drop a and mx if those hosts don't send | Shorter and two lookups fewer |
| Move a vendor to a subdomain | Its terms move to that subdomain's own record |
| Remove dead includes | Shorter, fewer lookups, no void-lookup risk |
Worked example
An agency's record listed 14 single ip4: addresses for an old relay plus five includes, 310 characters. The relay's addresses sat in one /28 block, so 14 terms became one; two includes were for tools no longer used. The new record was 120 characters in a single string, with 5 lookups instead of 9.
Check the result
Paste-free: the check reads the joined record exactly as receivers do. Run the domain through the free ReplyDak deliverability check: it reads MX, SPF, DKIM and DMARC live from public DNS, counts SPF lookups and checks the main blocklists, with no sign-up. If your DKIM selector is not a common one, type it into the optional selector box.
More setups and errors: SPF, DKIM and DMARC by provider, DNS host and error.
FAQ
What is the maximum length of an SPF record?
Each string is limited to 255 characters; a record can hold several strings, but RFC 7208 advises staying within a 512-byte DNS answer.
Do I add a space between split SPF strings?
Put the space inside one of the strings. Receivers join strings with no separator.
Is a split SPF record two records?
No. Several strings in one TXT record are one record.