"SPF too many DNS lookups" means a receiving server had to do more than 10 DNS lookups to check your SPF record, so it gave up and returned permerror, which counts as an SPF fail. Every include: costs at least one lookup, and the includes inside those includes count too.
The fix is almost always the same: fewer services sending from that one domain.
Key points
- SPF allows 10 DNS lookups in total; at 11 the result is permerror, which counts as a fail.
- Only include, a, mx, ptr, exists and redirect use lookups; ip4, ip6 and all are free.
- Nested includes count, so one include can cost five lookups, as the record at mailgun.org did when we checked.
- The cleanest fix is fewer senders per domain: delete dead includes and give each extra tool its own subdomain.
- Flattening (swapping includes for IP ranges) works only for vendors with stable addresses, and Microsoft says not to do it for Microsoft 365 at all.
What "too many DNS lookups" means
When a mail server receives your email, it looks up your SPF record and walks through it, asking "is the server that sent this on the list?" Some parts of the record are plain IP addresses it can compare straight away. Others are names it has to look up first, and those names often point to more names.
The SPF standard puts a hard cap on that. From RFC 7208, section 4.6.4: implementations "MUST limit the total number of those terms to 10 during SPF evaluation", and "If this limit is exceeded, the implementation MUST return "permerror"."
So 10 lookups is fine. 11 is a broken record. And the RFC is clear that the count is one global budget across the whole check, includes inside includes and all, "not just for a single instance of a recursive evaluation".
Permerror, in the RFC's words, means your records "could not be correctly interpreted" and the problem "definitely requires DNS operator intervention". Translation: nobody on the receiving side is going to work around it for you.
What counts toward the 10 lookups
The limit isn't "10 includes". It's 10 of these specific terms, wherever they sit in the chain.
| Term in the record | Uses a lookup? | Notes |
|---|---|---|
include: | Yes | Plus every lookup inside the record it points to |
a | Yes | Often added "just in case" for the web server |
mx | Yes | Rarely adds anything once your mail provider is included |
exists: | Yes | Checks whether a name exists, one lookup each time |
redirect= | Yes | Hands the whole check to another domain's record |
ptr | Yes | The RFC says it "SHOULD NOT be published". Delete it |
ip4: and ip6: | No | Free, however many you list |
all | No | The ~all or -all at the end |
That list comes straight from the RFC. Microsoft's SPF guide gives the same split (it just leaves ptr off its list) and spells out the nesting trap: an include that points to a record with three more includes "adds four total lookups". Hence its warning that "having fewer than 10 include: statements doesn't guarantee fewer than 10 DNS lookups".
There is one more limit that catches people. The RFC says servers "SHOULD limit "void lookups" to two", where a void lookup is a name that returns nothing. An include for a tool you cancelled years ago, whose domain is gone, is exactly that. Microsoft notes that if an include "doesn't resolve or has no SPF record, SPF validation returns permerror".
How to count your SPF lookups
You can do it by hand in five minutes, and it's worth doing once so the number stops being a mystery.
Start with your own record:
dig TXT example.com +short
Then, for every include:, look up that name and repeat until you reach records with only ip4: and ip6: in them. Add one for each include, a, mx, ptr, exists and redirect you meet on the way.
Here's a real chain, so you can see how fast it adds up. When we checked in November 2026, the record at mailgun.org looked like this (you can see it live through Google Public DNS):
mailgun.org v=spf1 include:_spf.mailgun.org include:_spf.eu.mailgun.org -all _spf.mailgun.org v=spf1 include:_spf1.mailgun.org include:_spf2.mailgun.org ~all _spf.eu.mailgun.org v=spf1 ip4:141.193.32.0/23 ip4:159.135.140.80/29 ... ~all _spf1.mailgun.org v=spf1 ip4:159.135.224.0/20 ip4:69.72.32.0/20 ... ~all _spf2.mailgun.org v=spf1 ip4:161.38.192.0/20 ip4:143.55.224.0/21 ... ~all
One include:mailgun.org in your record costs five lookups: mailgun.org itself, the two includes inside it, and the two inside those. Half your budget, from a single line.
Compare that with the two big mailbox providers. On the same day, `_spf.google.com` and `spf.protection.outlook.com` both listed their IP ranges directly with no further includes, so each one cost exactly one lookup. If you read somewhere that Google's include eats three or four lookups, check it yourself before you plan around it. Vendors change these records, which is the whole reason to recount instead of trusting an old blog post (this one included).
Now a made-up record, the kind that builds up over a few years at a small company. Northwind runs Google Workspace, kept Microsoft 365 for one old shared mailbox, sends receipts through Mailgun and newsletters through SendGrid:
v=spf1 mx include:_spf.google.com include:spf.protection.outlook.com include:mailgun.org include:sendgrid.net ~all
These include values are just for the example. In your own record, use whatever your tool's setup page tells you to add. Counted against the records as they stood in November 2026:
| Term | Lookups |
|---|---|
mx | 1 |
include:_spf.google.com | 1 |
include:spf.protection.outlook.com | 1 |
include:mailgun.org | 5 |
include:sendgrid.net (which includes ab.sendgrid.net) | 2 |
| Total | 10 |
Exactly 10. It passes, and nobody notices a thing. Then someone signs up for one more tool, adds one more include:, and the record breaks for every server that has to read it all the way through.
If you would rather not chase includes by hand, Google suggests the Check MX tool in its Admin Toolbox to count them, and our SPF record generator builds a record from the services you send with and shows the lookup count as you add each one.
What happens when you go over 10
The message fails SPF. What that looks like depends on the receiving server. Microsoft says the receiving system may bounce the message with one of these errors:
The message exceeded the hop count. The message required too many lookups.
Google's SPF troubleshooting page adds that error messages vary, and some even warn that you have no SPF record at all when you do. That one sends people hunting in the wrong place.
The really annoying part is that it can look random. Microsoft explains that receivers read the record "from left to right", and "Evaluation stops when the message source is validated". So mail from Google Workspace, listed first, can pass every time, while mail from whatever sits at the end of the record fails. Same record, different result per sender. If SPF fails for one tool and not another, count your lookups before you blame the tool.
Does a broken SPF record break DMARC?
Not on its own, if DKIM is set up properly. Under RFC 9989, the current DMARC standard, a message passes DMARC if at least one of SPF or DKIM passes for a domain aligned with the From address. A cold email sent from Google Workspace with your own DKIM key can still pass DMARC while SPF is in permerror.
Don't take that as permission to leave it broken. You've lost your backup, and Google's sender guidelines ask anyone sending more than 5,000 messages a day to Gmail accounts to "Set up SPF and DKIM", not one or the other. Our guide to the Google and Yahoo sender requirements has the full list.
How to fix too many SPF lookups
In the order I'd try them. The first two fix most records, and they leave the domain healthier anyway.
1. Delete includes for tools that no longer send
Open the record and ask, for each include, "does this service still send email as this exact domain?" The old helpdesk, the CRM you moved off, the form plugin from two websites ago. Google puts it plainly: "Remove any include mechanisms for third parties that no longer send mail for your domain."
While you are there:
- Remove duplicates. Google also says to "Remove duplicate mechanisms and mechanisms that refer to the same domain."
- Remove
ptrif it is there. - Question
aandmx. If your mail provider is already in the record as an include,mxrarely adds anything. If your website does not send email,adoes nothing useful.
On a record that has grown for a few years, this alone often gets you back under 10.
2. Move extra tools to subdomains
This is the fix I like best. SPF checks the domain in the envelope sender (what Microsoft calls the MAIL FROM address), and each domain or subdomain has its own record. Microsoft's own advice: move other email services to subdomains, because "Each subdomain has its own 10 lookup budget."
So the newsletter tool sends as news.example.com, the receipts go out from billing.example.com, and your root domain's record only lists the mailboxes your people actually type into. Look in each tool's domain settings for a custom sending or return-path domain. If it has one, that's where the subdomain goes.
For cold email, go one step further. If you run cold email on its own domain, that domain should send from one mailbox provider and nothing else. One include, one lookup, done. If you are not sure cold email belongs on a separate domain at all, should you use a separate domain for cold email makes the case.
3. Replace an include with the vendor's IP ranges, carefully
ip4: and ip6: cost nothing, so swapping a five-lookup include for its IP ranges saves five lookups. This is what people call SPF flattening.
It works, with a catch: if the vendor adds a new server and you don't update your record, mail from that server starts failing SPF and nobody tells you. Microsoft says flattening fits vendors with "stable, documented IP address ranges", that you should review flattened entries "at least quarterly", and that you shouldn't flatten Microsoft 365 itself, because its sending infrastructure "uses dynamic IP addresses that change frequently".
Two practical notes if you do it:
- A single string inside a TXT record maxes out at 255 characters. Long records are split into several quoted strings inside one TXT record, which the RFC says are joined "without adding spaces". That's not the same as two SPF records, which breaks SPF outright.
- Write down which include you replaced and when. Future you won't remember.
My view: flatten only when fixes one and two are not enough, and only the vendors whose IP lists you can find in their own documentation.
4. Send from fewer tools
Sometimes the real answer is that four different platforms send email as your main domain and two of them could be one. Microsoft lists consolidating email services as one of its three fixes. It's the least technical one and often the one that sticks.
Things that look like fixes but make it worse
- Adding a second SPF record. "This one is for the marketing tools." It doesn't work like that. A domain gets one SPF record, and the RFC says two of them return permerror on their own. The basics are in how to set up SPF, DKIM and DMARC.
- Switching ~all to ?all. The ending of the record has nothing to do with the lookup count.
- Trimming at random until a checker goes green. If you remove an include that is still sending, you have swapped a lookup problem for a real SPF fail on that tool's mail. Check your DMARC reports or the tool's settings first.
After any change, give it time before you judge. Google says fixes can take "between 24-48 hours" to take effect everywhere. Then send a real test email and check the header for spf=pass.
Keep it fixed
Lookups creep back. A teammate connects a new tool, its setup page says "add this include", and you're at 11 again. outr checks SPF, DKIM, DMARC and MX every day, but whatever you use, a monthly calendar reminder to recount your lookups costs nothing.
Right now, pull up your record, count the lookups (by hand or with a checker), and delete the first include you cannot explain.
Questions people ask
What is the SPF 10 DNS lookup limit?
RFC 7208 says a receiving server must stop after 10 DNS-querying terms while checking one SPF record, counting nested includes, and return permerror if the record needs more. The terms that count are include, a, mx, ptr, exists and redirect. The ip4, ip6 and all mechanisms do not count.
Does ip4 count as a DNS lookup in SPF?
No. The ip4: and ip6: mechanisms are compared directly against the sending server's address, so they never use a lookup. That is why replacing an include with a vendor's IP ranges reduces the count, as long as those ranges stay current.
Is exactly 10 SPF lookups OK?
Yes. The RFC says permerror happens when the limit is exceeded, so 10 passes and 11 fails. Sitting at exactly 10 leaves no room for the next tool or for a vendor adding an include to its own record, so aim lower.
What is a void lookup in SPF?
A void lookup is a DNS query in your SPF chain that comes back empty, usually an include pointing at a domain that no longer exists. RFC 7208 says servers should allow only two of them, and going past that returns permerror. Removing includes for cancelled tools fixes both problems at once.
Does SPF flattening hurt deliverability?
Not by itself, but a flattened record goes stale when the vendor changes servers, and mail from the new servers then fails SPF quietly. Microsoft recommends flattening only vendors with stable, documented IP ranges, reviewing them at least quarterly, and not flattening Microsoft 365.
Sources
- RFC 7208: Sender Policy Framework (SPF), section 4.6.4 DNS Lookup Limits
- Email sender guidelines, Google Workspace Admin Help
- RFC 9989: Domain-based Message Authentication, Reporting, and Conformance (DMARC)
- Set up SPF to identify valid email sources for your Microsoft 365 domain, Microsoft Learn
- Troubleshoot SPF issues, Google Workspace Admin Help
- SPF record for mailgun.org, Google Public DNS lookup
- SPF record for _spf.mailgun.org, Google Public DNS lookup
- SPF record for _spf.google.com, Google Public DNS lookup
- SPF record for spf.protection.outlook.com, Google Public DNS lookup
- SPF record for _spf.eu.mailgun.org, Google Public DNS lookup
- SPF record for _spf1.mailgun.org, Google Public DNS lookup
- SPF record for _spf2.mailgun.org, Google Public DNS lookup
- SPF record for sendgrid.net, Google Public DNS lookup
- SPF record for ab.sendgrid.net, Google Public DNS lookup
Written by the outr team
We build outr, an AI sales team that sends from your own inboxes and drafts every reply for you to approve. Every figure in this article links to the page it comes from, listed above.