SPF Mechanisms & RFC 7208 Lookup Cost Reference
Every v=spf1 record shares a hard ceiling of 10 DNS-querying mechanisms across the entire evaluation chain. Mechanisms that evaluate static IP addresses consume zero lookups, while nested vendor includes add every downstream query to your total.
| Mechanism / Tag | DNS Lookup Cost | Common Example | Production Guidance |
|---|---|---|---|
| include: | 1 + nested lookups | include:_spf.google.com | Audit nested depth; isolate marketing tools on subdomains |
| redirect= | 1 + nested lookups | redirect=_spf.example.com | Replaces all when delegating full SPF control |
| a / mx / exists: | 1 each (+ MX targets) | a mx | Omit bare a or mx if web/inbound servers never send |
| ptr | 1+ (deprecated) | ptr:example.com | Remove immediately; discouraged by RFC 7208 |
| ip4: / ip6: | 0 lookups | ip4:203.0.113.0/24 | Zero lookup cost; safe only for static dedicated IPs |
| ~all / -all | 0 lookups | ~all | Use ~all with DMARC or -all for strict rejection |
How This SPF Generator & Lookup Counter Works
In Generate SPF Record mode, the builder assembles a single canonical v=spf1 TXT string directly in your browser, deduplicating shared provider mechanisms (such as AWS SES include:amazonses.com) and estimating total recursive DNS lookups based on each vendor's nested include depth. Static ip4: and ip6: blocks are validated client-side and counted at zero lookups.
In Audit Live Domain SPF mode, our stateless Node.js resolver queries authoritative TXT records in real time without caching. It recursively expands every include: and redirect= branch up to depth 10 with cycle detection, tallies void lookups (NXDOMAIN or empty responses), checks the 255-character TXT string boundary, and ranks top-level mechanisms by total downstream lookup cost.
Frequently Asked Questions
How do I fix an SPF PermError caused by too many DNS lookups?
Start by auditing your live SPF tree in Tab 2 to identify which vendor include: consumes the most lookups. Remove retired providers, strip unused a, mx, and ptr tokens, and move marketing or billing tools onto dedicated sending subdomains such as mail.yourdomain.com so each subdomain gets its own 10-lookup budget.
Should I use ~all (SoftFail) or -all (HardFail) at the end of my SPF record?
Most modern deliverability teams pair ~all with an enforced DMARC policy (p=quarantine or p=reject). Using ~all avoids harsh pre-DMARC bounces on legitimate mailing list forwarders while still signaling unauthorized IPs. Use -all if your domain sends strictly from controlled, non-forwarded infrastructure.
What is an SPF void lookup and why does it matter?
RFC 7208 Section 4.6.4 enforces a second ceiling of 2 void lookups—mechanisms whose DNS query returns NXDOMAIN or zero records. Even if your total lookup count is 4 out of 10, three misspelled or decommissioned include: domains will trigger an immediate PermError.
Can I split a long SPF record into two separate TXT records?
No. Publishing two v=spf1 TXT records at the same hostname invalidates SPF with a PermError. If a single SPF string exceeds 255 characters, keep it inside one DNS TXT record split into multiple quoted 255-character strings (most modern DNS providers like Cloudflare and Route 53 handle this automatically).
Why does Google Workspace take 4 lookups while AWS SES takes 1?
include:_spf.google.com points to an SPF record that itself includes three nested netblock records (_netblocks, _netblocks2, and _netblocks3), totaling 4 DNS lookups. AWS SES (include:amazonses.com) lists its IPv4 ranges directly inside a single TXT record, consuming just 1 lookup.