RFC 7208 Lookup Limits Explained
Sender Policy Framework (RFC 7208) prevents unauthorized servers from forging your domain in the SMTP MAIL FROM (envelope sender) header. To shield receiving mail servers from amplification loops and slow recursive DNS chains, RFC 7208 Section 4.6.4 enforces two strict runtime ceilings during SPF evaluation:
- Maximum 10 DNS-Querying Mechanisms: Every
include:,a,mx,ptr,exists:, andredirect=mechanism (including nested evaluations inside third-partyinclude:chains) increments a global lookup counter. On the 11th DNS lookup, receivers MUST abort evaluation withPermError. - Maximum 2 Void Lookups: A void lookup occurs when a DNS query returns
NXDOMAIN(domain does not exist) orNOERRORwith zero answer records. Exceeding 2 void lookups also triggersPermError.
Static mechanisms (ip4:, ip6:, all) and modifiers like exp= do not consume any DNS lookups.
PermError vs. TempError & DMARC Impact
Understanding the difference between SPF failure modes prevents misdiagnosing inbox drops:
PermError(Permanent Error): Caused by exceeding 10 DNS lookups, exceeding 2 void lookups, publishing more than onev=spf1TXT record at the apex (RFC 7208 Section 3.2), or syntax errors. DMARC (RFC 7489) evaluates SPFPermErroras authentication fail. If DKIM alignment is missing or fails on forwarded mail, messages bounce (550 5.7.1) or land in spam.TempError(Transient Error): Caused by DNS timeouts orSERVFAILresponses from your authoritative nameservers. Compliant MTAs typically return a4xxtemporary deferral and retry later rather than permanently rejecting the message.
Counted, not estimated: two of the biggest domains on the internet sit at exactly 10
Most explanations of the lookup limit invent an example stack and assign it plausible numbers. Instead, here are real records, counted recursively on 27 November 2026 under the RFC 7208 §4.6.4 rule: every include:, a, mx, ptr, exists: and redirect= costs 1, plus whatever the record it points to costs; ip4:, ip6: and all cost 0.
github.com — 10 of 10. GitHub authorizes its own servers with ip4: ranges (free) and then stacks eight vendors on top:
| Term in github.com’s record | Lookups it costs | Why |
|---|---|---|
include:spf.protection.outlook.com |
1 | Microsoft’s record is a flat list of IP ranges — 0 nested terms |
include:_netblocks.google.com |
1 | IP ranges only — 0 nested terms |
include:_netblocks2.google.com |
1 | IP ranges only — 0 nested terms |
include:mail.zendesk.com |
1 | Flat IP list — 0 nested terms |
include:_spf.salesforce.com |
2 | Its record contains an exists: lookup of its own |
include:servers.mcsv.net (Mailchimp) |
1 | Flat IP list — 0 nested terms |
include:mktomail.com (Marketo) |
1 | 0 nested terms when counted |
include:sendgrid.net |
2 | Its record includes ab.sendgrid.net in turn |
| Total | 10 | One more vendor include and github.com PermErrors |
oracle.com — also exactly 10, reached a different way: six includes (spf_s, spf_r, spf_c, spf_x, spf_z.oracle.com and stspg-customer.com), four of which nest further terms of their own.
And the counter-examples, counted the same day: microsoft.com uses 6 (four includes, two of which nest one more term each), and google.com uses exactly 1 — its only term is include:_spf.google.com, and that record is nothing but ip4:/ip6: ranges. The lesson cuts both ways. The limit is not a big-company problem or a small-company problem; it is a stacking problem. Google proves a giant sender can run at 1. GitHub and Oracle prove how eight ordinary vendor decisions — an ESP here, a helpdesk there, a CRM nobody told IT about — add up to the ceiling with zero headroom for the next tool someone signs up for.
Three operational details the real counts expose:
- You cannot price an include from the top-level record. Some vendor includes are flat IP lists and cost the minimum 1 forever. Others hide
exists:or furtherinclude:terms and cost 2+. The only way to know is to resolve the whole chain — which is what the flattener above does mechanically. - Microsoft flattened its own house.
spf.protection.outlook.com— the include that millions of customer domains pay lookups for — resolves to a flat list of IP ranges with no nested terms at all. That is the static-flattening strategy from the table below, practised by the vendor itself, on the record its customers depend on. - 9 is already broken. If your count is 9 or 10, you do not control when it becomes 11 — a vendor adding one nested term to their record does it for you, silently, and your first symptom is receivers returning PermError on mail you didn’t change.
Count your own record in two minutes: run it through the SPF checker, which walks the chain for you — or by hand: write down every include:/a/mx/exists:/redirect= term, fetch each include target’s record, count its terms too, and recurse until every branch ends in ip4:/ip6:/all:
dig +short TXT example.com | grep -i "v=spf1"
dig +short TXT _spf.google.com
Static vs. Dynamic Flattening & Architectural Alternatives
The SPF Flattener recursively traverses include: and redirect= chains (up to depth 10) and consolidates discovered ip4: and ip6: networks into a single record requiring 0 DNS lookups. Before publishing a flattened TXT record, weigh the operational trade-offs:
| Strategy | DNS Lookups | Maintenance Risk | DNS Packet / TXT Constraints |
|---|---|---|---|
| Prune unused includes | Reduced | Zero drift | Always step 1: remove decommissioned vendors |
| Dedicated subdomains | 1–4 per subdomain | Very low | Move SendGrid/HubSpot to mail.example.com with own SPF + DKIM |
| Static flattening | 0 lookups | Medium (IP rotation drift) | Cloud ESPs expand CIDRs; must re-flatten periodically |
| Dynamic scheduled flattening | 0–1 lookups | Low (automated sync) | Requires API automation against Cloudflare/Route 53 |
Critical DNS TXT edge cases when flattening:
- 255-Octet String Limit (RFC 7208 Section 3.3): Individual character-strings inside a
TXTrecord cannot exceed 255 bytes. Long flattened SPF records must be split into multiple adjacent quoted strings ("v=spf1 ip4:... " "ip4:... ~all"), which receivers concatenate automatically. - UDP 512-Byte Response Size: Very large CIDR lists bloat UDP DNS replies beyond 512 bytes, forcing TCP fallback and risking timeouts on legacy mail relays. If your flattened list exceeds ~20–25 CIDR blocks, subdomaining high-volume ESPs (
bounce.example.com,em.example.com) is cleaner and avoids CIDR drift completely. - Single Record Rule: Replace your existing apex
v=spf1record; never add a secondv=spf1TXT record alongside it.
Validate your updated record with the SPF Checker, build new vendor policies with the SPF Generator, enforce alignment via DMARC Analyzer and DMARC Generator, and verify end-to-end compliance on Email Health.
