SPF PermError: too many DNS lookups (the 10-lookup limit) and how to fix it
Updated 10 November 2026 · 6 min read
Short answer
SPF allows at most 10 DNS-querying terms per check: every include:, a, mx, ptr, exists: and redirect= counts, including those inside nested includes, while ip4:, ip6: and all do not. Past 10, receivers return permerror and SPF fails for every message. Fix it by removing services that no longer send, moving bulk senders to their own subdomain (each name gets its own 10), or replacing a stable vendor's include with its documented IP ranges.
What counts toward the 10
| Term | Counts? | Note |
|---|---|---|
include: | Yes, 1 + whatever the included record uses | Nested includes add up |
a, mx | Yes, 1 each | mx also resolves each MX host's addresses |
exists:, redirect= | Yes, 1 each | |
ptr | Yes | RFC 7208 says it should not be used at all |
ip4:, ip6:, all | No | Free |
Worked example: counting a real record
v=spf1 include:_spf.google.com include:spf.protection.outlook.com
include:sendgrid.net include:mail.zendesk.com include:servers.mcsv.net
include:_spf.salesforce.com a mx ~allSix includes plus a and mx is 8 at the top level. But Google's _spf.google.com itself includes three more records (_netblocks, _netblocks2, _netblocks3), and several of the others nest too. The real total is well over 10, so this domain's SPF fails everywhere even though it "looks" like 8. The free deliverability check counts top-level lookups; for nested ones, look each include up with dig TXT and count down the tree.
Fixes, in order of preference
- 1
Delete dead senders
Old CRMs, a helpdesk you left, the web host's include. Each one you remove saves at least one lookup.
aandmxare often there by habit; drop them if your web server and inbound mail servers don't send mail. - 2
Use subdomains for third parties
Microsoft's guidance is to send bulk and vendor mail from a subdomain (news.acme.com) with its own SPF record. Each name has its own 10-lookup budget, and your staff mail keeps its reputation.
- 3
Check whether the vendor needs SPF at all
SendGrid with automated security, Postmark and Mailchimp align through their own return-path setups or DKIM; their include in your root SPF often does nothing.
- 4
Flatten carefully
Replacing an include with
ip4:ranges removes lookups, but you must track the vendor's IP changes. Microsoft says never to flattenspf.protection.outlook.com, and the same applies to Google.
Check the result
After trimming, re-check and keep a margin: aim for 7 or 8 lookups, not exactly 10. Run the domain through the free ReplyDak deliverability check: it reads MX, SPF, DKIM and DMARC live from public DNS, counts SPF lookups and checks the main blocklists, with no sign-up. If your DKIM selector is not a common one, type it into the optional selector box.
More setups and errors: SPF, DKIM and DMARC by provider, DNS host and error.
FAQ
Does ip4: count as a DNS lookup?
No. ip4: and ip6: are matched directly. Only include, a, mx, ptr, exists and redirect cause lookups.
Does having fewer than 10 includes guarantee I'm under the limit?
No. Nested includes count too, so 6 includes can easily mean 12 lookups.
What error do receivers show for too many lookups?
SPF permerror; some bounce messages say the message required too many lookups or exceeded the hop count.
Is SPF flattening safe?
Only for vendors with stable, documented IP ranges, and only if you review them regularly. Don't flatten Google or Microsoft.