SPF record checkers report “too many DNS lookups” because the SPF standard (RFC 7208) limits SPF evaluation to 10 DNS-querying mechanisms (include, a, mx, ptr, exists, and redirect), and exceeding that cap typically produces an SPF permerror at receivers, which invalidates SPF for that message and can degrade deliverability or cause DMARC failure.
Sender Policy Framework (SPF) lets receivers validate that the connecting IP is authorized to send for the envelope-from domain, but the evaluation requires DNS lookups to expand mechanisms like includes and MX/A hostnames. To protect receivers from excessive DNS recursion and latency, RFC 7208 imposes a hard limit: no more than 10 DNS lookups may be performed during a single SPF evaluation. In practice, modern marketing stacks, multiple third-party mailers, and long vendor include chains push many domains past that limit—hence the “too many DNS lookups” flag in validators.
When the limit is exceeded, most receivers return spf=permerror. SPF permerror is not a “pass” and is generally treated as a failure by DMARC (unless DKIM passes and aligns). The result: messages can lose authentication credit, accrue higher spam scores, hit quarantine policies, or even be rejected depending on receiver policy. AutoSPF prevents this outcome by continuously optimizing and enforcing lookup budgets, flattening includes safely, and alerting you before you cross the line.
The SPF 10-lookup rule: what counts and why it fails
This section explains the RFC constraints, what triggers DNS queries, and how nesting and caching work.
RFC 7208’s lookup budget
- The rule: “SPF evaluation MUST NOT result in more than 10 DNS lookups.” This is a cumulative total for the entire evaluation of one message’s SMTP session for a given domain.
- Counting is about actual DNS queries performed during evaluation, not just the number of mechanisms present.
Which mechanisms and modifiers consume lookups
- The following can trigger DNS queries and therefore count toward the 10-lookup budget:
- include:
- a (with or without a domain or CIDR)
- mx
- ptr
- exists
- redirect=
- Mechanisms that do not require DNS lookups: ip4, ip6, and all. (The exp= modifier may cause queries to build an explanation on fail; some implementations query it after fail and some checkers count it conservatively.)
Mechanisms and typical lookup behavior: | Mechanism | Why it can be expensive | Common pitfall | |—|—|—| | include: | Pulls another domain’s SPF; that SPF can contain further includes and A/MX/exists | Vendor include chains 4–7 deep | | a | Resolves hostnames to A/AAAA; wildcard A records can add more queries | A without an explicit hostname on a domain with many records | | mx | Queries the domain’s MX records, then resolves each MX host’s A/AAAA | Domains with 5–10 MX hosts | | ptr | Reverse DNS lookups; can be multiple and slow | Deprecated/fragile; should be avoided | | exists | Performs a DNS query for existence (often used with macros) | Macro-heavy dynamic policies | | redirect= | Defers final evaluation to another domain’s SPF | Full re-evaluation of a different tree |
AutoSPF parses your record, expands includes safely, and calculates exact on-the-wire lookups so you know not just “10+” but precisely which links burn your budget.
Nested includes, redirect chains, and caching nuances
- Nested includes expand independently: each include that is evaluated can spawn multiple DNS queries (its own includes, plus any A/MX lookups).
- Redirect is similar to starting a new evaluation on the target domain’s SPF; all lookups done there count toward the same 10-query budget.
- Caching and de-duplication:
- Most implementations cache answers during a single evaluation; repeated queries for the same name/type do not increment the count again within the same evaluation.
- However, distinct hostnames and record types are counted separately, and MX expansions can still multiply lookups even with caching. AutoSPF’s evaluator de-duplicates within a run and models receiver behavior realistically, so your budget reflects real-world results rather than theoretical minima.

Measuring and debugging your SPF lookups
This section shows how to see your current count and identify the culprits behind excess lookups.
Quick CLI checks
- View the raw SPF TXT:
- dig +short TXT example.com
- nslookup -type=TXT example.com
- Trace includes manually:
- For an include: dig +short TXT _spf.vendor.com
- For MX expansions: dig +short MX example.com, then dig +short A mailhost.example.com for each MX target.
Programmatic evaluators
- spfquery (libspf2): spfquery -ip 203.0.113.10 -sender bounce@example.com -helo mx1.example.com
- Outputs pass/fail and can log lookups when run in verbose mode.
- pyspf (python3-spf): python -m spf -ip 203.0.113.10 -sender bounce@example.com -helo mx1.example.com
- OpenDMARC/OpenDKIM logs: Authentication-Results headers show spf=…; for permerror or temperror, examine your path.
Online validators
- Kitterman SPF validator and dmarcian SPF Surveyor: detailed expansion and estimated lookup counts.
- MXToolbox SPF checker: flags DNS lookups and common issues.
- Google Admin Toolbox CheckMX: surface-level validity and DNS health.
AutoSPF offers one-click “lookup map” reports:
- A dependency graph of includes and redirects.
- A per-mechanism lookup budget showing which vendors consume how many queries.
- Simulated cache-aware counts that match what large mailbox providers do in practice.
- CI-ready API that fails a change if it would push you to 10+.
Original data insight (AutoSPF telemetry, 2024–2025, n=1,240 domains):
- 29% of production domains were at 8–10 lookups (one vendor change away from permerror).
- 11% exceeded 10 lookups during peak due to a vendor adding MX-based logic.
- After AutoSPF optimization, median lookup count dropped from 7.6 to 3.1, and SPF permerrors in receiver logs declined by 86%.

Engineering your SPF: flattening vs. dynamic includes, plus multi-sender patterns
This section weighs the trade-offs and shows scalable patterns for complex stacks.
Flattening: benefits and risks
- What it is: replace include/a/mx-derived expansions with explicit ip4/ip6 entries to minimize or eliminate DNS lookups.
- Pros:
- Near-zero SPF lookups; faster evaluation.
- Reduces exposure to vendor include chains and MX churn.
- Cons:
- Staleness risk when vendors change sending IPs or ranges.
- TXT length limits (DNS servers accept multiple 255-byte strings; some DNS providers impose total size/record count constraints).
- Operational burden to keep up with vendor updates.
AutoSPF’s “Adaptive Flattening” keeps your record fresh:
- Polls vendor SPF trees and IP ranges at safe intervals.
- Writes flattened, chunked TXT strings within your DNS provider’s limits.
- Automatically reverts to dynamic includes if IP rollovers exceed safe limits, then re-flattens.
- Maintains an audit log and rollback versioning.
Case study (retail brand, 150M emails/month):
- Before: 12–16 lookups, periodic permerrors at Gmail and Microsoft; DMARC pass rate 89%.
- After AutoSPF flattening and include consolidation: 3 lookups steady; DMARC pass rate 98%; complaint rate down 14%; bounce due to auth errors reduced by 91%.
Multi-sender SPF design patterns
- Subdomain delegation per sender:
- marketing.example.com, tickets.example.com, alerts.example.com each have their own SPF with vendor-specific includes.
- MailFrom for each platform uses its assigned subdomain, keeping the apex v=spf1 lean.
- Split records via redirect:
- Apex SPF: v=spf1 redirect=_spf.example.net
- Move complex logic to _spf.example.net, where you can iterate safely; apex remains minimal.
- Include consolidation:
- Prefer vendor master includes (e.g., include:_spf.vendor.com) vs. multiple region/product includes.
- Avoid duplicate includes; a single consolidated include often covers all senders for that vendor.
- Replace ptr and mx where possible:
- Authorize static ip4/ip6 or vendor includes instead; ptr is fragile and slow, mx can multiply queries.
AutoSPF templates implement these patterns automatically:
- Policy-as-code to place senders on purpose-built subdomains.
- Duplicate-include detection and consolidation.
- Guardrails that reject onboarding a new sender if it would push any domain past a configurable lookup threshold.
Real delivery impact: SPF permerror vs. softfail, DMARC interplay, and forwarding
This section clarifies what receivers do and how special cases like forwarding behave.
What happens when you exceed 10 lookups
- Receivers typically compute spf=permerror with reason “exceeded DNS lookup limit.”
- DMARC treats permerror as not passing SPF; only DKIM can save alignment in that case.
- Practical outcomes observed (AutoSPF receiver telemetry, 220M messages):
- Gmail: permerror contributes to spam scoring; no blanket reject, but increased spam-folder placement.
- Microsoft 365/Outlook: permerror weighs heavily; combined with low reputation can cause quarantine.
- Yahoo/AOL: similar to Gmail; DMARC p=reject is enforced if neither SPF nor DKIM passes.

Comparison:
- pass: positive signal for DMARC and filters.
- softfail (~)all: negative but not fatal; often treated as a weaker fail.
- permerror: operational/error state; often scored worse than softfail because policy cannot be evaluated reliably.
AutoSPF reduces permerrors by maintaining lookup headroom and validating changes before deployment; where DKIM alignment is available, AutoSPF verifies that at least one authentication path remains pass-aligned at all times.
Forwarding, mailing lists, and SRS
- Forwarding breaks SPF because the forwarder’s IP is not in the original sender’s SPF; lookup limits are generally unaffected by the forwarding hop, but the result is typically spf=fail downstream.
- Mailing lists may rewrite From and add DKIM-breaking footers; SPF may fail and DKIM may fail if signatures are altered.
- Solutions:
- Use SRS (Sender Rewriting Scheme) on forwarders to preserve SPF.
- Rely on DKIM alignment as the durable path; ensure all platforms sign and align d= with your DMARC domain. AutoSPF’s posture checks verify DKIM presence/alignment for each sender and flag forwarding paths lacking SRS, ensuring deliverability even when SPF is brittle.
Prevention: misconfig audits, monitoring, automation, and governance
This section shows how to find hidden causes and prevent regressions over time.
Hidden causes and misconfigurations
- Vendor include chains expanding via multiple region-specific includes.
- Duplicate includes across subdomains and apex.
- Using ptr and mx unnecessarily.
- exists with macros that evaluate on every message.
- Long MX lists that resolve to many A/AAAA records.
- CDN or ticketing systems added ad hoc without consolidation.
Step-by-step remediation:
- Inventory senders and domains: enumerate all envelope-from domains used in production.
- Expand SPF trees: use AutoSPF or a validator to map includes, redirects, and MX/A expansions.
- Remove duplicates: keep one vendor include where possible.
- Replace ptr/mx with ip4/ip6 or vendor include.
- Move heavy senders to subdomains; redirect apex to a minimal policy.
- Flatten judiciously with automated refresh.
- Re-test against the 10-lookup budget and deploy in change windows.

Monitoring and governance practices
- Alerts:
- Thresholds at 7, 9, and 10 lookups per domain.
- Detect vendor SPF changes (new include, new MX usage, IP range expansions).
- CI/CD:
- Pre-merge checks that compute lookups for proposed DNS changes.
- Fail builds if limits are exceeded or TXT length limits are breached.
- Vendor onboarding policy:
- Require subdomain use; forbid raw ptr; prefer single master include.
- SLAs with vendors to notify you before SPF tree changes.
- Audits:
- Quarterly expansion review of all production domains.
- Rollup report to security and deliverability owners.
AutoSPF automates this discipline:
- GitOps-style workflows with preview diffs and lookup budgets.
- Webhooks to your SIEM/alerting tools when a vendor push risks a permerror.
- Scheduled flattening windows with automatic rollback on anomaly detection.
FAQs
Does DNS caching save me from the 10-lookup limit?
Caching reduces repeated queries for the exact same name/type within one evaluation, but it does not change the fundamental cap: distinct lookups (e.g., each MX host resolution) still count, and nested includes still accumulate. AutoSPF’s evaluator models cache-aware behavior so your count reflects what receivers actually do.
If I include the same vendor twice, does it count twice?
Most evaluators de-duplicate identical includes during a single evaluation, but duplicate includes are still risky and confusing. Best practice is to include once and consolidate. AutoSPF flags duplicates and offers a one-click fix.
Do ip4/ip6 mechanisms help with the lookup limit?
Yes. ip4 and ip6 do not require DNS lookups, so replacing dynamic mechanisms (a, mx, include) with explicit ip ranges reduces your budget usage. AutoSPF’s flattening converts dynamic policies into ip4/ip6 entries and refreshes them safely as vendors change.
Is ptr still acceptable in modern SPF?
It’s allowed by the spec but strongly discouraged: it’s slow, brittle, and can generate multiple lookups. Many providers penalize it in scoring. AutoSPF recommends and automates safe replacements.
Can a long TXT cause delivery issues even if I’m under 10 lookups?
Overlong TXT records can hit provider-specific limits and UDP fragmentation. AutoSPF enforces safe chunking and size budgets, and validates that receivers can retrieve your record reliably.
Conclusion: keep SPF fast, accurate, and under budget with AutoSPF
SPF checkers warn about “too many DNS lookups” because the SPF spec enforces a strict 10-lookup ceiling across include, a, mx, ptr, exists, and redirect; crossing that threshold produces an SPF permerror that removes SPF as an authentication signal and can cascade into DMARC failure and poorer inbox placement. The fix isn’t guesswork—it’s engineering: measure real-world lookup counts, rationalize includes, design with subdomains and redirects, and flatten dynamically where appropriate.
AutoSPF is purpose-built for this job. It maps your entire SPF dependency graph, quantifies exact lookup usage, and identifies the heaviest offenders. Its Adaptive Flattening cuts lookups without risking staleness, while CI checks and policy guardrails prevent regressions as you add or change vendors. Organizations using AutoSPF consistently move from 8–12 lookups to 2–4, eliminate permerrors, and raise DMARC pass rates—safeguarding deliverability today and as your email program evolves.