Home › Blog › SPF PermError: How to Count Nested Lookups and Fix the 10-Lookup Limit
Your SPF record can be syntactically perfect and still silently fail every check, because RFC 7208 caps evaluation at 10 DNS lookups, nested includes count, and going over returns permerror. Here's how the counting actually works, how to audit your own record, and three safe ways to get back under.

Run your domain through our SPF Checker, it recursively resolves every include and shows a numbered lookup tree against the 10-lookup meter. Over the limit? 1) Delete includes for services you no longer use. 2) Move non-critical services to subdomain SPF records (each gets its own budget of 10). 3) Flatten stable providers to ip4 ranges, carefully. Most over-limit records fix with step 1 alone.
The 10-lookup limit is cold email's most common silent killer because it fails invisibly and arrives gradually. Your record was fine at 6 lookups. Then marketing added HubSpot, support added Zendesk, someone added a second ESP "just to test", and one Tuesday you crossed 10. Nothing errored, no dashboard turned red; receivers just started returning permerror, your SPF stopped counting for anything, and placement sagged with no visible cause. The record still reads perfectly, syntax checkers pass it, because the problem isn't syntax, it's arithmetic.
v=spf1 include:_spf.google.com include:sendgrid.net include:mailgun.org a mx ~all
include:_spf.google.com = 1
└ 3 nested _netblocks includes = 3 (hidden inside Google's record)
include:sendgrid.net = 1
└ 1 nested include = 1
include:mailgun.org = 1
a = 1
mx = 1
total = 9 of 10 ← one more service breaks itAudit every include against reality: are you actually still sending through that service, from this domain? Old ESP trials, a switched marketing platform, a survey tool from 2023, records accumulate includes like garages accumulate boxes. Each deletion refunds its whole subtree. Most over-limit records we see fix entirely at this step, and the discipline that keeps them fixed is treating the SPF record as an allowlist you own, not a guestbook anyone can sign.
Each domain and subdomain evaluates its own SPF with its own 10-lookup budget. So move services to where they belong: marketing platform sends from news.yourco.com with its own SPF, support tool from help.yourco.com, and your root (or better, your separate sending domains) carries only what actually sends there. Cold email sending domains done right need just one or two includes, their budget is never the problem; it's shared multi-purpose domains that overflow.
Flattening replaces an include with the ip4/ip6 ranges it resolves to, lookups drop to zero. The catch: providers rotate ranges without telling you, and a stale flattened record silently un-authorizes their new IPs, failing SPF for real mail. So flatten only stable, slow-moving providers, or use tooling that re-resolves and updates automatically, and never hand-flatten Google or Microsoft, whose ranges shift. Flatten last, after fixes 1 and 2, for the stubborn remainder.
spf=pass with your domain in the envelope is the finish line. And remember only ONE SPF record may exist per domain: merging fixes into a second TXT record is itself a permerror.RFC 7208 caps SPF evaluation at 10 DNS-querying mechanisms per check: every include, a, mx, ptr, exists, and redirect costs one, and includes count recursively, so include:_spf.google.com costs 1 for itself plus 3 more for the includes nested inside it. Exceed 10 and receivers return permerror: your SPF effectively fails despite the record looking valid.
Permerror means receivers couldn't evaluate your SPF, most treat it as SPF failing, and under DMARC your SPF identity contributes nothing, leaving DKIM alone to carry alignment. Practically: worse placement everywhere, and if DKIM also has issues, DMARC failures. It's the most common 'everything looks configured but we're in spam' cause we find in audits.
You can't count just the visible mechanisms, you have to resolve every include and count what's nested inside, recursively. ip4/ip6/all cost zero; include/a/mx/ptr/exists/redirect cost one each at every level. Our free SPF Checker does the full recursive walk and shows a numbered lookup tree with a meter against the limit, that's the audit, done.
In order of preference: (1) delete includes for services you no longer send from, audits routinely find 2-3 dead ones; (2) move non-cold-email services (marketing, support tools) onto subdomain SPF records, since each subdomain gets its own 10-lookup budget; (3) flatten selectively, replace a stable provider's include with its ip4 ranges, but only with automation or for providers whose ranges rarely change, because manual flattening breaks silently when providers rotate IPs.
No, ip4:, ip6:, and all cost zero lookups because they need no DNS resolution. That's exactly why flattening works: swapping include:provider.com (1+ lookups) for the equivalent ip4: ranges (0 lookups) buys back budget. The trade-off is maintenance: those ranges are now your responsibility to keep current.
Prewarmed Inboxes So You Can Send Cold Emails Today
Get Prewarmed & Fresh InboxesGoogle, Microsoft 365 and Azure inboxes with free prewarmed domains and DNS configured before you log in. Prewarmed inboxes send the day they land; every order is delivered within 48 to 72 hours.
Get Prewarmed & Fresh Inboxes