I get the error message ”CharacterStringTooLong (Value is too long) encountered with {Value}" error when I attempt to add a TXT record with SPF format to my domain. How can I resolve this?

TXT records have a DNS limitation of 255 bytes; for more information, see RFC 1035 section 2.3.4. SPF records with a string longer than 255 bytes cannot be split into multiple strings because of the SPF format, and you cannot have two SPF TXT values for the same record. Additionally, SPF records have a lookup limit of 10, which includes redirects; for more information, see RFC 4408.

Note: If your record is a standard TXT record (not using SPF format or syntax), see How do I resolve "TXTRDATATooLong" errors when creating a TXT record?

As a workaround, you can create multiple records instead of using one.

In this example, we create 2 records that each contain roughly half of the desired record content. You can store some validated IP addresses in a TXT SPF record and then store the rest in a second one. For example, spfva.example.com contains half of the validated IPs/CIDRs, and spfvb.example.com contains the other half. You can use the "include" SPF macro to refer to all the SPF records and then use them in your domain or subdomain as a TXT record only.

Alternatively, you could include 3 records as follows:

spfva.example.com "v=spf1 ip4: ip4: ?all"
spfvb.example.com "v=spf1 ip4: ip4: ?all"
"v=spf1 mx include:spfva.example.com include:spfvb.example.com ?all"

Note: The IP addresses, CIDRs, and domains are just examples; be sure to replace them with your own network settings.

The SPF qualifiers and results include the following:




In this example, we have configured all the records as "Neutral", but different combinations might be necessary for your use case.

Note: The content of an SPF TXT record is not analyzed by Route 53. It's interpreted as plain text like any other TXT record.

For additional information on the "include" macro and the "SPF" format, see RFC 4408: include.

Route 53, SPF, record sets, TXT 

Did this page help you? Yes | No

Back to the AWS Support Knowledge Center

Need help? Visit the AWS Support Center

Published: 2017-03-23