Setup
SPF PermError: too many DNS lookups, and how to fix it

By the JasReach team. Updated . 6 min read.
SPF stops working after 10 DNS lookups. Add one more tool to your record and every email you send can fail the check.
10 DNS lookups is the hard limit for one SPF check (source).
Short answer
SPF allows at most 10 DNS lookups when a receiver checks your record. Every include, a, mx, ptr, exists and redirect counts, including the ones nested inside your providers' records. Go over 10 and SPF returns a permanent error, which counts as a failure. Fix it by removing services you no longer use, replacing a and mx with IP addresses, or moving some senders to a subdomain.
Key takeaways
- The limit is 10 lookups, counted across nested includes too.
- ip4, ip6 and all do not count; include, a, mx, ptr, exists and redirect do.
- There is a separate limit of 2 lookups that return nothing.
- A PermError can break DMARC if SPF is your only aligned method.
SPF records tend to grow quietly. Each new tool, from a newsletter service to a help desk, asks you to add one more include. Eventually the record works on paper but fails for every receiver that checks it properly.
Why does SPF have a 10-lookup limit?
The SPF standard, RFC 7208, caps the DNS queries a receiving server will make while checking one record. Without a cap, a badly made or malicious record could force mail servers into hundreds of lookups for every email.
When the cap is exceeded, the result is permerror, a permanent error. Receivers treat that like a failed check.
What counts toward the limit?
Watch out: There is also a separate limit: lookups that return no answer (void lookups) should not exceed 2. An include pointing at a domain that no longer exists can trip it.
| Part of the record | Counts? | Notes |
|---|---|---|
| include: | Yes | Plus every lookup inside the included record. |
| a, mx | Yes | mx can add more for each mail server it finds. |
| ptr, exists | Yes | ptr is discouraged by the standard. |
| redirect= | Yes | Points to another domain's record. |
| ip4:, ip6: | No | Plain IP addresses need no lookup. |
| ~all, -all | No | The ending rule. |
Five ways to get under the limit
- Remove includes for services you no longer use. This alone often fixes it.
- Replace a and mx with the actual ip4 or ip6 addresses if they rarely change.
- Move marketing or support tools to a subdomain, such as mail.yourdomain.com, with its own SPF record.
- Check whether a provider offers a smaller include for just the service you use.
- As a last resort, flatten the record into IP addresses, but only with a tool that keeps it updated when providers change their IPs.
Build a clean SPF record
Tick the services that send email as your domain. Use one record per domain, and check the final lookup count with a domain checker before you publish.
Interactive SPF record builder available on this page.
Common SPF mistakes
- Two SPF records on the same domain. Receivers treat this as an error; merge them into one.
- Ending with +all, which lets anyone send as you.
- Leaving out the service that actually sends your cold email.
- Typos such as include_spf.google.com without the colon.
Questions people ask
How do I count my SPF lookups?
Run your domain through an SPF or domain health checker; it follows every include and reports the total. Counting by hand misses nested lookups.
Does a PermError mean my emails will bounce?
Some receivers reject, most treat it as an SPF failure. If DKIM still passes and aligns, DMARC can pass, but you lose a layer of protection.
Is SPF flattening safe?
It works, but if a provider changes its IP addresses and your flattened record is not updated, legitimate email starts failing. Use it only with automatic updates.