The maximum number of DNS lookups allowed in a single SPF record check is 10. This is a hard limit defined in the Sender Policy Framework (SPF) specification, RFC7208. It's a common stumbling block for many businesses as they start using more third-party services to send email on their behalf.
Every time you add a new service like a helpdesk, CRM, or marketing platform to your SPF record, you're likely adding another lookup. Before you know it, you've gone past the limit, and your SPF record becomes invalid, which can seriously harm your email deliverability.
The limit isn't arbitrary. It exists primarily for security and performance reasons. When a receiving mail server checks an incoming email, it has to perform a series of DNS lookups to validate the sender's SPF record. Without a limit, a malicious actor could craft a complex SPF record that forces the receiving server to perform an excessive number of DNS queries.
This could be used to launch a Distributed Denial of Service (DDoS) attack against the server or its DNS resolvers. As noted in the SPF specification (RFC7208), the limit is there to stop senders from placing an unreasonable load on the validating server. It ensures that SPF checks remain fast and efficient, preventing delays in email processing.
Not every part of an SPF record counts towards the 10-lookup limit. It's important to understand which mechanisms trigger a DNS query. The mechanisms that count are those that require looking up another DNS record:
Mechanisms like ip4, ip6, and all do not perform any DNS lookups and therefore do not count towards the limit.
When a receiving mail server evaluates an SPF record and finds that it requires more than 10 DNS lookups, it immediately stops processing and returns a permanent error, often called a "PermError".
This PermError invalidates your entire SPF record. From the perspective of the receiving server, it's as if you have no SPF record at all. As a result, your DMARC alignment for SPF will fail. If your DKIM signature also fails or is not present, your emails are much more likely to be rejected or sent to the spam folder, as DuoCircle explains here. This is a critical deliverability issue that can go unnoticed until you start seeing widespread delivery problems.
Managing your SPF record to stay under the limit is an ongoing process, especially for growing businesses. Here are some effective strategies:
What is the maximum 'pct' value in a DMARC record?
What is the maximum number of characters allowed in a DMARC TXT record?
Can a DMARC record have multiple 'p' tags?
What DNS record type is used for DKIM?
What is the maximum recommended key length for DKIM?
Does DKIM signature verification involve a DNS lookup?