SPF Lookup Limit: Count Includes Before PermError
SPF allows 10 DNS lookups. On 22 November 2026, github.com was at 10 and google.com was at 1. Count the chain before you add a sender.
TL;DR
SPF evaluation may perform at most 10 DNS lookups. The 11th is a PermError. include, a, mx, ptr, exists, and redirect each count as one. ip4, ip6, and all do not. Nested includes count. On 22 November 2026, google.com used 1 lookup and github.com used 10.
Last updated: November 22, 2026
You will leave with a count for your own record, not a slogan about flattening. The SPF Analyzer reports that count as lookup_count after it walks the include tree. The rules below are RFC 7208 section 4.6.4.
If you are publishing a record for the first time, start with how to set up an SPF record. This page is only the cap.
The limit is on mechanisms that cause a DNS query during evaluation. It is not a count of packets, and it does not include the TXT query that fetched your own SPF record.
| Term | Counts toward 10? |
|---|---|
include: | Yes. One, plus every counting term inside the included record |
redirect= | Yes. One, plus the counting terms in the target record |
a | Yes. One, even when the lookup returns both A and AAAA |
mx | Yes. One, even when each MX host is then resolved to addresses |
ptr | Yes. One |
exists: | Yes. One, including a macro such as exists:%{i}._spf.example.com |
ip4: / ip6: | No |
all (-all, ~all, ?all, +all) | No |
exp= | No. That lookup happens only after the result is already a failure |
A record that is already at 10 is legal. One more counting term is a PermError, and receivers treat that as a permanent error, not as a soft fail.
The Analyzer follows the same rule. An a mechanism increments lookup_count by 1, which matches the tests on the expander. The A and AAAA queries it makes to collect addresses are not extra points on the cap.
SPF has several results. Only one of them means "this record cannot be evaluated."
| Result | Meaning |
|---|---|
pass | The sending IP is in the evaluated set |
fail | The IP is not in the set, and the record ends in -all |
softfail | The IP is not in the set, and the record ends in ~all |
neutral | The record ends in ?all, or has no all |
temperror | DNS failed temporarily while evaluating. Try again |
permerror | The record is invalid or over a hard limit. Retrying will not help |
A sender that is simply missing from the record gets fail or softfail. A sender that is authorized, on a record with 11 counting terms, gets permerror along with everyone else. Mail from the right servers fails evaluation because the record itself is broken. That is the outage people notice as "we added a vendor and mail from the old vendors started failing too."
github.com on 22 November 2026 was one include away from that. The eight providers on the TXT line are not eight lookups. Two of those providers spend a second lookup, and the total is already 10.
Queried on 22 November 2026:
google.com. TXT "v=spf1 include:_spf.google.com ~all"
_spf.google.com. TXT "v=spf1 ip4:74.125.0.0/16 ip4:192.178.47.0/24 … ip6:… ~all"The only counting term is include:_spf.google.com. The included record is ip4 and ip6 ranges. Those do not count. The total is 1.
_netblocks.google.com and _netblocks2.google.com are still published, and other domains still include: them. google.com itself no longer goes through that chain. A guide that still says Google costs three or four lookups is describing an older record. A domain that still publishes include:_netblocks.google.com pays one lookup for a record that is only ip4 ranges. That include is on the GitHub record below.
The same day, github.com published this record (TXT strings joined):
v=spf1 ip4:192.30.252.0/22
include:spf.protection.outlook.com
include:_netblocks.google.com
include:_netblocks2.google.com
include:mail.zendesk.com
include:_spf.salesforce.com
include:servers.mcsv.net
include:mktomail.com
include:sendgrid.net
ip4:62.253.227.114 ip4:166.78.69.169 ip4:166.78.69.170 ip4:166.78.71.131
~allEight includes are eight lookups. The ip4 mechanisms and ~all add nothing. The included records, queried the same day:
| Included record | Counting terms inside it |
|---|---|
spf.protection.outlook.com | None. ip4 and ip6 only |
_netblocks.google.com | None. ip4 only |
_netblocks2.google.com | None. ip6 only |
mail.zendesk.com | None. ip4 only |
_spf.salesforce.com | exists:%{i}._spf.mta.salesforce.com counts as 1 |
servers.mcsv.net | None. ip4 only |
mktomail.com | None. ip4 only |
sendgrid.net | include:ab.sendgrid.net counts as 1. That target is ip4 only |
8 + 1 + 1 = 10. One more include: on github.com, or one new counting term inside SendGrid or Salesforce, and the record is over the limit. This is why a flat list of eight providers can still be a full budget: two of them spend a second lookup.
Paste the domain into the SPF Analyzer and read lookup_count. For this record the number to expect is 10, not 8.
v=spf1. Two records that both start with v=spf1 are already a PermError, before the lookup cap comes into it. The SPF record reference covers the mechanisms.lookup_count. Treat 8 and 9 as full. Treat 10 as no room for another sender that uses include, a, mx, exists, ptr, or redirect.ip4 and ip6. That child is where the extra points hide. SendGrid's extra include: is the one in the GitHub tree.lookup_count goes from 9 to 11.A provider's setup page that says "add include:spf.example.com" is describing their record today. If they later add an a or another include, your count goes up and you will not see it in your own TXT line.
Replace a counting term with addresses when the included record is already a list of ranges. That is what google.com did: _spf.google.com is the ranges, and the domain pays for one include instead of a nest of _netblocks names.
Do this only for a provider whose ranges you are willing to re-check. An ip4 copy does not follow the provider when they add a new block. An include does. Flattening a record that changes every month trades a PermError for a silent miss.
mx and a on your own domain are the usual waste. If the mail servers already have stable addresses, ip4 and ip6 authorize them without spending a lookup. Keep include for providers that tell you to, and spend it on those.
ptr counts as one and is a poor authorization mechanism. RFC 7208 discourages it. Removing it both saves a lookup and drops a mechanism receivers do not want.
Section 4.6.4 also caps void lookups at two. A void lookup is a DNS query during evaluation that returns no records or NXDOMAIN. A third one is a PermError even when lookup_count is under 10.
The Analyzer does not report that second cap. lookup_count is the 10-mechanism limit only. If a receiver still says PermError and the Analyzer says 6, check for includes that no longer exist.