The SPF 10-Lookup Limit: Why You Exceed It and How to Cut Lookups
One of the most common SPF problems is the limit of 10 DNS lookups. Here is how lookups are counted and what to do when you go over.
Published: November 13, 2026 · 日本語
What the 10-lookup limit is
The SPF specification (RFC 7208) caps the DNS queries a receiver makes while evaluating SPF at 10 per evaluation. The rule exists so that an attacker cannot use an SPF record that triggers a huge number of DNS queries to put load on receiving servers.
Go over the limit and the SPF result becomes permerror (a permanent error), which counts as a failure. SPF is effectively broken, so unless DKIM works, DMARC fails too. Legitimate mail can end up in spam or be rejected.
What counts as one lookup
The mechanisms and modifiers that need a DNS query are counted.
| Counted | Not counted |
|---|---|
include, a, mx, ptr, exists, redirect | ip4, ip6, all |
The catch is that everything inside the records you include is added up too. Your own record may have only three includes, but if those records contain more includes or an mx, those count as well. An mx counts once, but looking up the address of each host the MX points to has its own separate limit (up to 10 per mx).
There is one more: some implementations return permerror when more than two references point at names that do not exist (void lookups), as the specification recommends. Leaving an include for a service you no longer use makes it easier to hit this limit as well.
Typical reasons records go over
- An
includewas added every time the company adopted a newsletter service, help desk, invoicing system, CRM or chat tool. - The
includefor a large service such as Google Workspace or Microsoft 365 contains several references of its own, so one include uses up several lookups. - An
includefor a service you cancelled is still there. - Old
mx,aorptrmechanisms are kept "just in case". The specification itself discouragesptr.
How to reduce lookups
1. Remove what you do not use
Do this first. List the services you have cancelled and the senders you no longer actually use, and delete their includes. That alone often brings you back under 10.
2. Drop ptr and unneeded mx and a
If your own mail server has a fixed address, you can replace mx or a with the address itself in ip4 or ip6. ip4 causes no DNS query. You will, however, need to update it yourself if the IP address changes.
3. Use a separate subdomain for each purpose
Send day-to-day staff mail from example.com and newsletters or notifications from mail.example.com, and so on. SPF is evaluated per domain, so each gets its own budget of 10. It also makes DMARC alignment easier to manage by role.
4. Consider SPF flattening (with care)
"Flattening" means expanding the IP addresses behind your includes in advance and listing them with ip4. It cuts lookups sharply, but when a service changes its IP addresses your record is not updated automatically. Leave stale IPs in place and legitimate mail fails. You need either a flattening service that follows changes automatically or a routine of updating the record by hand.
Watch the record length too
An SPF record lives in a TXT record. A single string can be at most 255 characters, so a longer record is split into several strings. If the whole record grows too long, the DNS response can exceed the standard UDP size (512 bytes) and fail to load in some environments. Check the length regularly, not just the lookup count.
Checking and day-to-day tips
- Recount lookups after every change. The DMARC Check shows the current lookup count against the limit of 10 and warns when you are over or close.
- Before adopting a new sending service, check that you have lookups to spare.
- Publish only one SPF record per domain. Having more than one is enough to make SPF invalid.
- Keep an inventory of senders (which service sends what, for what purpose, from which domain). It makes clean-ups much easier.
FAQ
Is exactly 10 lookups fine?
Up to 10 is allowed, but there is no headroom. Adding one more sending service will push you over. Aiming for 7 or 8 in normal times is safer.
Should I end SPF with -all or ~all?
-all fails senders you have not authorized and is the stricter choice. ~all is a softer setting that marks them as suspicious. With DMARC in place, either works. If your list of senders is well organized, -all is recommended.
What if I cannot reduce the includes?
Splitting mail by purpose into subdomains is the safest approach. If that is still hard, consider flattening, but you will need a process that keeps up with IP address changes at your sending services.
Check your own domain
Enter your domain and the points in this article are checked for free. No sign-up.
Check your SPF lookup count