Splitting a long SPF TXT record

Updated 1 year ago by Laura Goepel

When to split your DNS record vs flatten it.

What is SPF record splitting?

When a DNS TXT exceeds 255 characters, then it must be split into multiple strings.

As defined in [RFC1035] sections 3.3.14 and 3.3, a single text DNSrecord (either TXT or SPF RR types) can be composed of more than onestring. If a published record contains multiple strings, then therecord MUST be treated as if those strings are concatenated togetherwithout adding spaces. For example:IN TXT "v=spf1 .... first" "second string..."MUST be treated as equivalent toIN TXT "v=spf1 .... firstsecond string..."SPF or TXT records containing multiple strings are useful inconstructing records that would exceed the 255-byte maximum length ofa string within a single TXT or SPF RR record.

What is SPF record flattening?

This article does not go into all the details of flattening. The purpose of flattening a record is to avoid the dreaded 10 DNS lookup limit perm fail error. Every time you include a 3rd party's SPF record, it counts against your 10 lookup limit. Some 3rd party providers even include other records in their own, so these also count against the limit.

Flattening is the process of converting the included SPF entries into a list of IP addresses and then including them in your record. The downside of doing this is that you must monitor the 3rd party records if they change and then update yours accordingly.


How did we do?