Skip to content
All Articles
Email Authentication

SPF 10 DNS Lookup Limit: What It Is, Why It Matters, and How to Fix It

Exceeding SPF's 10 DNS lookup limit causes a 'permerror' that can result in your emails being rejected. Learn how to count lookups and reduce them.

6 min read

What is the 10 DNS lookup limit?

RFC 7208 (the SPF specification) limits SPF evaluation to 10 DNS lookups. This prevents SPF from being used in DNS amplification attacks and keeps evaluation fast.

If your SPF record requires more than 10 DNS lookups, the receiving server returns a 'permerror' result — which most mail servers treat the same as a fail. This means your emails may be rejected or marked as spam even though you're a legitimate sender.

The 10-lookup limit is strict and is enforced by most modern mail servers.

Which mechanisms count as lookups?

Mechanisms that count: include:, a, mx, ptr, exists, redirect=

Mechanisms that do NOT count: ip4:, ip6: (these are direct IP comparisons, no DNS needed), all

Each include: directive not only counts as 1 lookup itself, but also adds the lookups from the included domain's SPF record recursively. This is how organizations exceed the limit without realizing it — including _spf.google.com might trigger 3-4 more lookups internally.

SPF mechanisms — what counts vs. does not count toward the 10-lookup limit

MechanismCounts as Lookup?WhyExample
include:Yes (+sub-lookups)Requires DNS lookup; also adds lookups from the included record recursivelyinclude:_spf.google.com (may use 3–4 total)
aYesRequires A/AAAA DNS lookup for the domaina:mail.yourdomain.com
mxYesRequires MX DNS lookup, then A lookup for each MX hostmx:yourdomain.com (can use 2+ lookups)
ptrYes (deprecated)Requires PTR lookup; avoid — slow and unreliableptr:yourdomain.com
exists:YesRequires DNS lookup to check if record existsexists:%{i}.blacklist.example.com
redirect=YesReplaces evaluation with target domain's SPF (counts its lookups)redirect=spf.otherdomain.com
ip4:NoDirect IP comparison — no DNS query neededip4:203.0.113.0/24
ip6:NoDirect IPv6 comparison — no DNS query neededip6:2001:db8::/32
allNoCatch-all with no DNS lookup-all or ~all

How to count your lookups

Use an SPF checker tool that recursively counts all DNS lookups in your chain. Manual counting:

1. Parse your SPF record and count each include:, a, mx, ptr, exists 2. For each include:, fetch that domain's SPF record and count its mechanisms too 3. Repeat recursively until all chains are counted 4. Total must be ≤ 10

Example: v=spf1 include:_spf.google.com include:sendgrid.net include:spf.protection.outlook.com ~all

This looks like 3 lookups, but each include expands to more, potentially totaling 8-12+

How to reduce SPF lookups

Replace include: with ip4:/ip6: where possible: If you know the specific IP ranges a service uses and they're stable, use ip4: instead of include:. No lookup required.

SPF flattening: A service that resolves all your include: chains and converts them to flat ip4: entries. Risk: if a provider changes their IPs, your SPF breaks until you reflatten.

Remove services you no longer use: Audit your SPF record and remove includes for services you've stopped using.

Consolidate sending: Use fewer sending services, each with fewer lookups.

Sub-selector SPF: Route different email types (transactional vs marketing) through different subdomains with separate SPF records — each with fewer lookups.

SPF records
# OVER THE LIMIT — 12+ lookups (will cause permerror)
v=spf1 include:_spf.google.com include:sendgrid.net
        include:spf.protection.outlook.com
        include:servers.mcsv.net include:_spf.salesforce.com
        a:mail.yourdomain.com mx ~all

# FIXED — 4 lookups (uses ip4: to eliminate include: calls)
v=spf1 include:_spf.google.com
        ip4:149.72.0.0/16 ip4:167.89.0.0/16
        ip4:40.92.0.0/15 ip4:40.107.0.0/16
        ip4:104.47.0.0/17
        ip4:198.2.128.0/18
        ~all

# Notes:
# _spf.google.com = 1 lookup (Google Workspace)
# ip4: ranges replace SendGrid, Outlook, Mailchimp, Salesforce includes
# Each ip4: costs 0 lookups
# Total: 1 lookup (well under the 10 limit)

Check your domain's email health

Run a free scan against 60 blacklists. Validate SPF, DKIM, DMARC, and MX records in seconds.