SPF ‘too many DNS lookups’: what the 10 lookup limit is and how to fix it
Your emails land in spam, or a checker says “SPF permerror: too many DNS lookups”. The cause is nearly always the same: your SPF record needs more than 10 DNS lookups.
What counts as a lookup
SPF lets receivers ask DNS “is this server allowed to send for this domain?”. To stop abuse, the spec caps a single check at 10 DNS-querying terms. These count:
include:amxptr(deprecated, avoid)exists:redirect=
These cost nothing: ip4:, ip6: and all.
The catch is that includes are followed. If you write include:_spf.google.com, that’s one lookup, plus whatever Google’s own record includes underneath. Every sending service you add (marketing email, helpdesk, CRM, invoicing) adds its own chain. Five or six services can push you past 10 without you ever writing a long record.
When a receiver passes 10, it gives up and treats SPF as failed with a permanent error. Some receivers then reject or junk your mail.
Check your own count
Paste your domain into the free SPF record checker. It follows every include and shows the real total, the policy, and plain-English problems. It runs in your browser, with no sign-up.
Or from a terminal:
dig +short TXT example.com | grep spf1
dig +short TXT _spf.google.com # then follow each include by hand
How to get under 10
- Delete services you no longer use. Old email tools are the most common culprit.
- Replace
aandmxterms withip4:addresses if the addresses rarely change. IP terms are free. - Remove
ptr. It’s slow, deprecated and counts. - Use a subdomain per service. Send marketing mail from
news.example.comwith its own SPF record, so the main domain’s budget isn’t shared. - Flatten as a last resort. Flattening replaces includes with the IP ranges they resolve to. It works, but those ranges change, so the record goes stale unless something refreshes it automatically.
Other SPF mistakes to check while you’re there
- More than one SPF record. A domain must have exactly one. Merge them.
+allor?allat the end. Use~allwhile testing and-allwhen you’re sure of your senders.- Missing DKIM and DMARC. SPF alone doesn’t protect your From address. See the DMARC checker and DKIM lookup.
Checking many domains
If you manage a lot of domains (an agency, an MSP, or a due-diligence list), the Domain Intelligence API runs the SPF, DKIM and DMARC checks for a whole list in one run and returns the results as rows.