Max. Number of char in a TXT Record

Kevin Darcy kcd at
Thu Mar 26 23:19:46 UTC 2009

Darvin Denmian wrote:
> Hello,
> I have some questions:
> 1) Anybody know the maximum number of characters allowed in a TXT field?
A simple question, but a complicated answer.

You may have multiple "strings" in a single TXT record. Each "string" 
may be up to 255 characters in length, with a "length byte" indicating 
the size of the "string"'s payload. I don't believe there is any 
arbitrary limitation on the number of "string"s in a TXT record, but the 
RDATA itself may not exceed 65535 bytes in total, which is comprised of 
both the length-bytes and payloads of all "string"s contained therein. 
That 64K limit is a general restriction on DNS records of all types, not 
specific to TXT records.

Note that any DNS response which exceeds 512 bytes is slightly 
undesirable, since in the absence of EDNS0 (which the vast majority of 
-- but not all -- implementations honor these days), responses which 
exceed 512 bytes will signal truncation and prompt a retry via TCP. It's 
optimal to stay within 512 bytes if possible.
> 2) What is the maximum number of includes inside a SFP field?
I assume you mean SPF (Sender Policy Framework), the anti-SPAM(ming) 
mechanism (?)

I'm no SPF expert but in glancing at the documentation it looks like 
there is no arbitrary limit on the number of "include"s. Since SPF 
"records" are stuffed into (one or more?) TXT records, the above limits 
in the answer to question #1 would apply.

Maybe someone with better knowledge of and/or experience with SPF can 
confirm or deny.

- Kevin

More information about the bind-users mailing list