What the error means
SPF records can point to other records: include: pulls in another domain's SPF record, mx looks up your mail servers, and so on. Each of those is a DNS query the receiving server has to make while your message waits. To stop a single SPF check turning into hundreds of queries, the SPF standard (RFC 7208, section 4.6.4) sets a hard limit: at most 10 DNS lookups per SPF evaluation, counting everything inside included records too.
When a record needs an 11th lookup, the receiver stops and returns PermError, a permanent error. In practice that's treated like a failure:
- SPF doesn't pass for any of your messages, not just the ones from the last service you added.
- If DMARC relies on SPF for some of your mail, that mail now fails DMARC, and with
p=quarantineorp=rejectit goes to spam or bounces.
Worse, it usually appears suddenly: either when someone adds one more include, or when a provider you include adds a lookup to their record, without you changing anything.
Check your count. The SPF checker expands every include and shows exactly how many lookups your record uses.
Open the SPF checkerWhat counts toward the limit
| Term | Counts? | Notes |
|---|---|---|
include: | Yes, 1 | Plus every lookup inside the included record, recursively |
a, a:host | Yes, 1 | |
mx, mx:domain | Yes, 1 | Looking up the MX hosts' addresses doesn't add to the 10, but a domain may have at most 10 MX hosts here |
exists: | Yes, 1 | Mostly used with macros |
ptr | Yes, 1 | RFC 7208 says it should not be used: slow and unreliable. Remove it |
redirect= | Yes, 1 | Plus the lookups in the record it points to |
ip4:, ip6: | No | Free: the address is right there in the record |
all | No |
There's a second, related limit: the standard recommends that receivers allow no more than two void lookups (lookups that return no records, or a domain that doesn't exist) and return PermError beyond that. Includes for services you stopped using are the usual cause.
How to count your lookups
Here's a record for a fictional company with a typical mix of services:
v=spf1 a mx include:spf.mailhost.example include:_spf.crm.example
include:mail.newsletter.example include:spf.helpdesk.example
include:servers.invoicing.example ~all
Expanded, with the cost of each part:
a 1
mx 1
include:spf.mailhost.example 1
include:spf2.mailhost.example 1
include:_spf.crm.example 1
include:_netblocks.crm.example 1
include:_netblocks2.crm.example 1
include:_netblocks3.crm.example 1
include:mail.newsletter.example 1
include:spf.helpdesk.example 1
include:servers.invoicing.example 1
a:smtp.invoicing.example 1
----
12 over the limit
Only seven terms are visible in the record, but it costs 12 lookups. That gap is why the problem surprises people. The SPF checker draws this tree for your own record.
Six ways to fix it
Work through these roughly in order: the first ones are free and permanent, the last ones need ongoing care.
1. Remove what you no longer use
Records collect includes for tools that were trialled once, replaced or switched off years ago. For each include, ask whether that service still sends email as your domain today. DMARC aggregate reports answer this definitively: a service that hasn't appeared in your reports for a couple of months isn't sending as you. Remove dead includes first; they may also be causing void lookups.
2. Remove includes that don't help
This one surprises people. SPF is checked against the envelope sender (the bounce address), not the visible From address. Many marketing and helpdesk services send with their own bounce domain, so the SPF check is made against the service's record, not yours, and your include is never consulted.
To find out, send a test message through the service and look at the Return-Path in the header analyzer. If it's at the service's domain, the include in your record does nothing. Remove it, and make sure the service signs with DKIM for your domain instead, which is what makes DMARC pass for that mail.
3. Replace a and mx with IP addresses
If a and mx point to servers with fixed addresses, list the addresses directly. ip4 and ip6 cost nothing:
Before: v=spf1 a mx include:… ~all
After: v=spf1 ip4:203.0.113.25 ip4:203.0.113.26 include:… ~all
Often mx isn't needed at all: if your mail is hosted by Microsoft 365 or Google Workspace, your MX servers are already covered by their include, and your inbound servers don't send your outbound mail.
4. Move senders to subdomains
Each subdomain has its own SPF record with its own 10-lookup budget. Send marketing from news.example.com, support from help.example.com and invoices from billing.example.com, each with only the includes it needs. This also separates reputation: a newsletter that annoys recipients doesn't drag down your main domain. With relaxed DMARC alignment, these subdomains still align with your organizational domain.
Many services let you set a custom bounce domain on a subdomain for exactly this reason: they ask you to point something like bounce.example.com at them with a CNAME, and SPF is handled by their record.
5. Flatten carefully, or not at all
"Flattening" means replacing includes with the IP ranges they currently resolve to. It works: a flattened record can cost zero lookups. But providers change their IP ranges without warning, and a flattened record doesn't follow. Mail from the new addresses fails SPF silently until someone notices.
Only flatten if something keeps it up to date automatically, such as a service that rebuilds the record when the provider's ranges change, and never flatten the include of your main mail platform by hand.
6. Use macros (advanced)
SPF macros let a record ask a single exists: lookup about the exact sending IP, for example exists:%{ir}._spf.example.com, with a special DNS zone answering yes or no. It's powerful, used by some SPF management services, but hard to get right and to debug. It's not something to build by hand for a typical domain.
A worked example
Going back to the fictional record above (12 lookups):
- The helpdesk sends with its own bounce domain: remove its include (saves 1).
- The invoicing tool was replaced last year: remove it (saves 2).
mxpoints to the mail host, which is already included: remove it (saves 1).ais the web server, which sends contact-form mail from one fixed address: replace withip4:(saves 1).
v=spf1 ip4:203.0.113.25 include:spf.mailhost.example include:_spf.crm.example
include:mail.newsletter.example ~all
That's 7 lookups, leaving room for growth, with nothing flattened and nothing to maintain.
After the fix
- Check it. Run the SPF checker again and confirm the count and that there's still exactly one record.
- Test each sender. Send a message through each service you kept and look for SPF: pass or DKIM: pass aligned with your domain in the header analyzer.
- Keep headroom. Aim for 8 or fewer, so a provider adding a lookup to its own record doesn't push you over.
- Watch DMARC reports for a week or two for any source that started failing.
Frequently asked questions
Can I just split my SPF record into two records?
No. A domain may have only one SPF record. Two records cause a different PermError, and splitting the content doesn't raise the limit, because includes are counted wherever they are. Use subdomains instead.
Do receivers really enforce the limit?
Assume they do: the standard says a receiver must return PermError when the limit is exceeded. Some receivers are more lenient, which is why an over-limit record can seem to work for a while. Don't rely on it.
Does the limit apply to DKIM or DMARC?
No. The 10-lookup limit is specific to SPF. DKIM is a single lookup per signature, and DMARC is one or two lookups per message.
Why did my count change when I didn't edit anything?
Because the count includes lookups inside other companies' records. When a provider you include adds an include of its own, your total goes up. Keeping a margin below 10 absorbs those changes.
Is ~all or -all better while I fix this?
It makes no difference to the lookup problem: PermError happens before the receiver reaches all. Fix the count first.