[Articles](https://mailglo.com/articles/)

For AI agents: [llms.txt, the index of guides and public pages](https://mailglo.com/llms.txt)

# The SPF 10-lookup limit in RFC 7208

RFC 7208 requires a receiver to stop at the eleventh term that needs a DNS lookup and return an error, "permerror". The terms are `include`, `a`, `mx`, `ptr`, `exists` and `redirect`, counted across every record the check follows.

If your record already gets this error, [SPF PermError: too many DNS lookups](https://mailglo.com/docs/findings/spf-too-many-lookups/) explains what it does to your mail and how to fix it.

## Which terms count toward the limit?

[Section 4.6.4](https://www.rfc-editor.org/rfc/rfc7208#section-4.6.4):

```
The following terms cause DNS queries: the "include", "a", "mx",
"ptr", and "exists" mechanisms, and the "redirect" modifier.  SPF
implementations MUST limit the total number of those terms to 10
during SPF evaluation, to avoid unreasonable load on the DNS.  If
this limit is exceeded, the implementation MUST return "permerror".
```

The limit counts terms, not DNS queries, so following a CNAME doesn't add one. `all`, `ip4` and `ip6` need no lookup and don't count. Neither does `exp`, which is looked up only later, to explain a failure.

Terms in the records you include count too. [Section 4.1](https://www.rfc-editor.org/rfc/rfc7208#section-4.1) says the limit "must be tracked as a single global limit for all evaluations", not once per included record.

## Do the mx and ptr terms have their own limits?

Yes, on top of the 10. Both terms lead to further address lookups, and the standard caps those separately, with different outcomes:

- `mx`: "the evaluation of each "MX" record MUST NOT result in querying more than 10 address records". Past that, "the "mx" mechanism MUST produce a "permerror" result."
- `ptr` and the `%{p}` macro: the same cap of 10 address records applies to each PTR record, but past it "all records other than the first 10 MUST be ignored." No error.

For the `ptr` term itself, [section 5.5](https://www.rfc-editor.org/rfc/rfc7208#section-5.5) adds that when these limits are exceeded, "processing is terminated and the mechanism does not match".

Section 4.6.4 gives the reason: the domain owner controls its MX records, but the PTR records belong to whoever owns the sending server's address.

## Is there a time limit?

Recommended, not required. Receivers "SHOULD impose a limit on the maximum amount of elapsed time to evaluate check_host()". That limit "SHOULD allow at least 20 seconds", and past it "the result of authorization SHOULD be "temperror"" ([section 4.6.4](https://www.rfc-editor.org/rfc/rfc7208#section-4.6.4)). Slow nameservers can cause that error even under 10 lookups.

For domain owners, [section 10.1.1](https://www.rfc-editor.org/rfc/rfc7208#section-10.1.1) adds: "It is essential to publish records that do not exceed these requirements." It also suggests putting "lower-cost mechanisms earlier in the SPF record".

## Why 10?

To stop SPF being used to flood someone else's DNS. [Section 11.1](https://www.rfc-editor.org/rfc/rfc7208#section-11.1) describes attackers who publish records full of lookups aimed at a victim, then send mail so that receivers run them. It concludes: "the processing limits need to be quite low."

## Does every message reach all its terms?

No. The check stops at the first match, and only terms it reaches count. Mail from a service listed early can pass while mail from one listed after the eleventh term fails.

## Check your record

The standard sets the error, not what happens to the message ([what it leaves to receivers](https://mailglo.com/articles/spf-rfc-7208/#what-does-it-leave-to-receivers)). The free [SPF checker](https://mailglo.com/tools/spf-checker/) can show a lookup count. If it says "at least", that number doesn't tell you whether you're under the limit.

## Sources

- [RFC 7208, section 4.6.4](https://www.rfc-editor.org/rfc/rfc7208#section-4.6.4), the limit, the `mx` and `ptr` limits and the time limit.
- [RFC 7208, sections 4.1 and 5.5](https://www.rfc-editor.org/rfc/rfc7208#section-4.1), one count for all records followed, and what happens when a `ptr` limit is passed.
- [RFC 7208, sections 10.1.1 and 11.1](https://www.rfc-editor.org/rfc/rfc7208#section-10.1.1), the advice to domain owners and the reason for the limit.

Last updated 3 Dec 2026: New article: the 10-lookup limit quoted from RFC 7208, with its limits for mx and ptr.

Found an error, or a question this page does not answer? Email support@mailglo.com.
