Article
SPF Too Many DNS Lookups: How to Fix the 10-Lookup Limit
By Unlimited Verifier Team ·

Summary
SPF returns a 'too many DNS lookups' permerror when a record triggers more than 10 DNS-querying mechanisms, the limit set by RFC 7208. Fix it by counting the full include tree, removing unused senders, moving high-volume senders to subdomains, and flattening stable vendors into IP addresses.SPF returns a "too many DNS lookups" permerror when evaluating your record triggers more than 10 DNS-querying mechanisms, the hard limit RFC 7208 sets per domain. Fixing it means cutting the count to 10 or fewer, using three levers: removing dead includes, moving high-volume senders to their own subdomains, and flattening stable vendors into IP addresses.
Cold email and SaaS senders hit this limit most often. A main domain collects a mailbox provider, a warmup service, a CRM, a helpdesk and an outreach tool, and each one adds an include. The count then rises quietly, often because a vendor edited its own record. For the wider setup, start with the cold email infrastructure pillar.
Quick answer
- The limit is 10. RFC 7208 allows at most 10 DNS-querying lookups per SPF check and at most 2 "void" lookups, which are queries that return no records. Exceeding either produces a
permerror. - Count the whole tree, not the top-level record. Each
includecosts one lookup plus every lookup inside the record it points to. Records with several vendors often cost well above 10 once nested includes are counted. - Aim for 8, not 10. Two lookups of headroom absorb a vendor's next nested include without breaking your record.
- Fastest fix: delete includes for tools you no longer use, then move high-volume senders onto subdomains with their own SPF records.
- Prove the fix in headers. A real test message showing
spf=passbeats any checker. Then watch DMARC reports for one to two weeks.
What does "too many DNS lookups" mean in an SPF record?
SPF lets a receiving server check that a sending IP is authorised for the envelope sender's domain. To run that check, the receiver follows every mechanism in your record that needs a DNS query. RFC 7208 caps those queries at 10 per evaluation and caps void lookups at 2.
When the cap is exceeded, the receiver cannot complete the check. The result is a permerror, which gives no SPF pass. Your mail then depends entirely on DKIM to pass DMARC, and a single failing record can leave you without authentication on some messages.
The cap protects resolvers and receivers from unbounded chains of queries. It is also why the count must include nested records. Here is what counts toward the limit:
| Mechanism | Counts toward the 10? | What to know |
|---|---|---|
include:domain |
Yes: 1 plus everything nested inside | The usual culprit, because vendor records often nest more includes |
a / a:host |
Yes: 1 | Covers your own web or mail host's A record |
mx / mx:host |
Yes: 1, plus the MX host lookups | RFC 7208 also limits the MX names resolved to 10 |
ptr |
Yes | RFC 7208 discourages it. Remove it, because it still costs lookups |
exists:domain |
Yes: 1 | Uncommon, usually used for custom logic |
redirect= |
Yes: 1 plus nested | Counts like an include |
ip4: / ip6: |
No | Literal addresses need no lookup, which is why flattening works |
all |
No | The terminal qualifier |
Bottom line: Only mechanisms that trigger a DNS query count. Literal IP entries are free, and nested includes are the hidden cost.
Why do SPF records hit the limit, and why does it happen suddenly?
SPF records grow by accumulation. A tool is added for one campaign and rarely removed when the campaign ends. The pattern most teams find when they audit a record is that a modest-looking set of six top-level includes can cost 14 lookups once the vendors' own nested includes are counted.
The sudden failures are more dangerous. A vendor adds a nested include to its published record, and your count rises without any edit on your side. The record that passed last month now returns a permerror, and you find out from a DMARC report or a drop in inbox placement. A count from last quarter is therefore not a safe baseline.
Bottom line: Treat the lookup count as a moving number. Audit it on a schedule, not only after a failure.
How do you count your SPF lookups before changing anything?
Count the full tree yourself, then cross-check with a public checker. Checkers differ in how they handle void lookups and redirects, so your own tree is the authority. Three methods give you different things:
| Method | What it gives you | Limitation |
|---|---|---|
Manual dig tree |
Live DNS for every record, with an exact cost per branch | Slow, and needs a spreadsheet |
| Public SPF checker such as MXToolbox | A quick lookup count and syntax errors in one view | Its counting rules may differ from yours, and it reads DNS only |
| Real message headers | What receivers actually evaluated: spf=pass or a failure |
Shows the outcome, not the count |
Use all three. The tree gives the count, the checker catches obvious errors, and the headers prove the outcome.
- Pull your live record. Run
dig +short TXT yourdomain.comand keep the line that starts withv=spf1. If you see two SPF records, that alone causes a permerror, so merge them into one. - Query every include. For each
include:target, rundig +short TXT vendor.exampleand read the record. Repeat for every nested include until you reach records containing onlyip4,ip6andall. - Build the tree in a spreadsheet. Use three columns: domain, parent, and lookup cost. An include's cost is 1 plus the cost of its children, so a vendor with two nested includes costs 3.
- Sum the top-level costs. Add
a,mx,existsandredirectto the total. - Cross-check with a public tool. If MXToolbox's number differs from yours, look for a second TXT record, a
ptrmechanism or a void lookup. - Save the baseline. Record the total, the date and the tree. You will need it to prove the fix later.
Bottom line: Your own tree is the number that matters. A checker is a second opinion, and the headers are the proof.
What are the ways to fix a "too many lookups" SPF record?
Every fix trades lookups for some kind of work. The table shows what you give up with each one.
| Fix | Lookups saved | What it costs you | Best when |
|---|---|---|---|
| Remove unused includes | 1–3 per tool | Breaks sending if a tool still sends from your domain | Cancelled tools, dead trials, old CRMs |
| Move senders to subdomains | A whole branch, often 3–5 | A separate SPF record per subdomain, plus a warmup period | Cold outreach and bulk marketing with their own volume |
Flatten includes into ip4/ip6 |
1 per include | Ongoing work whenever vendor IPs change | Vendors that publish stable IP ranges |
Remove a or mx |
1 each | Safe only if the domain sends no mail from those hosts | Domains that receive mail or send only through vendors |
| Keep DKIM aligned as a backup | 0 | Does not lower the count | Always, as a complement to SPF |
Two points deserve attention. First, a subdomain only partly isolates reputation. Mailbox providers score several identities, so a subdomain protects the main domain in some cases but is not a firewall. Second, DKIM does not reduce the count. It keeps DMARC passing when SPF breaks, so it is a backup, not a fix.
For background on how these pieces fit, see the SPF, DKIM and DMARC setup guide.
Bottom line: Remove what is dead first, move what is high-volume second, and flatten only what is stable.
How do you flatten an SPF record without breaking sending?
Flattening replaces each include with the IP ranges it resolves to. The result has no nested lookups, but it is only as accurate as the day you built it.
- Get the vendor's sending ranges. Use the ranges the vendor publishes in its documentation where possible. A one-off lookup is a snapshot.
- Replace each include with
ip4:orip6:entries. Keep your existing qualifier, such as~all. - Split long strings into chunks of 255 characters or fewer. A TXT record can hold several strings, and SPF concatenates them.
- Lower the TTL in advance. Set it to 300 seconds a day before the change, so the update propagates quickly and a rollback is fast. Keep a copy of the old record.
- Publish and test. Send to a Gmail or Outlook test address and confirm
spf=passin the headers. - Schedule re-checks. Re-resolve the ranges monthly and whenever a vendor announces a change. Keep a dated changelog.
Sources disagree on record length. The traditional UDP DNS message limit is 512 bytes, set in RFC 1035, and many guides still cite it for TXT records. Modern resolvers fall back to TCP, so longer records usually work, but some older resolvers truncate them. Our recommendation: keep the flattened record under 512 bytes where you can, and test with dig +tcp if you can't.
The main failure is "flatten and forget." A vendor moves to new IP ranges, your flattened record still lists the old ones, and sending fails for that tool with no error on your side.
Bottom line: Flattening trades lookups for maintenance. Flatten only vendors whose ranges you can keep current.
Should you move senders to a subdomain, and what does it cost?
Yes, for any sender with its own volume. A subdomain gets its own SPF record and its own budget of 10 lookups, which removes that sender's branch from your main record entirely.
Consider outreach.yourdomain.example. It can carry the outreach tool's SPF and a custom return path, while the main domain carries only transactional senders. Whether DMARC still aligns depends on your policy. Under relaxed SPF alignment (aspf=r, the default), a subdomain in the envelope sender matches the organisational domain. Under strict alignment (aspf=s), it does not. RFC 7489 defines both modes, so check your DMARC record before you move anything.
The cost people underestimate is reputation. A new subdomain starts without a sending history, so it needs its own warmup. Plan a warmup period using one of the email warmup tools, and keep daily volume in line with how many cold emails per inbox per day and how many inboxes one domain can carry.
Parked or secondary domains need separate handling. A domain that never sends should publish v=spf1 -all, which tells receivers that no host is authorised to send. Without it, anyone can spoof the domain. For those cases, see subdomain vs secondary domain for cold email and how to redirect secondary domains to your main site.
Bottom line: Subdomains give each sender a lookup budget of its own, and relaxed alignment usually keeps SPF passing. Check aspf first, then budget for warmup.
How do you choose the right fix for your record?
Pick the fix by your count and by what is still sending. Use this table as a starting point.
| Situation | Recommended approach |
|---|---|
| 11–12 lookups, all includes still active | Flatten one stable vendor that publishes its ranges |
| 13+ lookups with several active senders | Move bulk and cold senders to subdomains |
| Vendor with unpredictable IP changes | Keep the include and move that sender to a subdomain |
| Domain that only receives mail | Remove a and mx, and publish -all only if it never sends |
| Parked or secondary domain | Publish v=spf1 -all |
| Two SPF TXT records on one name | Merge them into one before anything else |
Bottom line: Clean up dead senders first, because it costs nothing. Then choose between flattening and subdomains based on how stable each vendor is.
What does a real fix look like, step by step?
This example is hypothetical. "Brightline Outfitters" and its vendors are invented placeholders, so the arithmetic is the lesson.
Baseline. Brightline's top-level record has seven includes plus a and mx. The tree breaks down like this:
| Branch | Lookup cost | Status |
|---|---|---|
| CRM (include with 3 nested includes) | 4 | Active |
| Helpdesk (include with 1 nested include) | 2 | Active |
| ESP one (include with a plain IP list) | 1 | Active |
| ESP two (include with 2 nested includes) | 3 | Active |
| Billing tool (include) | 1 | Cancelled eight months ago |
| Survey tool (include with 1 nested include) | 2 | Unused |
| Outreach tool (include with 2 nested includes) | 3 | Active, cold email |
a (web host) |
1 | Active |
mx (mail host) |
1 | Not used for outbound |
| Total | 18 | 8 over the limit of 10 |
Changes, in order.
| Step | Action | Change | Running total |
|---|---|---|---|
| Start | Baseline | — | 18 |
| 1 | Remove billing tool (cancelled) | −1 | 17 |
| 2 | Remove survey tool (unused) | −2 | 15 |
| 3 | Move outreach to outreach.brightline.example with its own SPF |
−3 | 12 |
| 4 | Drop mx (outbound mail never uses the main MX host) |
−1 | 11 |
| 5 | Move helpdesk to support.brightline.example with its own SPF |
−2 | 9 |
| 6 | Flatten ESP one into ip4 entries |
−1 | 8 |
The final record uses 8 of 10 lookups, leaving 2 spare. If the CRM vendor adds one nested include, the record still passes.
The list side. Brightline's outreach list has 58,000 prospects, and the new subdomain should not send until that list is verified. On the Pro plan, each list can hold up to 25,000 emails, so the file splits as 25,000 + 25,000 + 8,000 = 58,000. Standard verification is unlimited on every plan, so it can run across the full file. Pro includes 25,000 deep verifications a month, which covers the segment you are least sure about. The cost is one month of Pro at $29, or $25 a month if billed annually. Pricing for other tools varies, so compare them using email verification pricing as a benchmark.
Bottom line: Ordered cleanup took the record from 18 to 8 lookups without removing a sender that was still in use.
How do you confirm the SPF fix actually works?
Confirm with a real message. A checker reads DNS, but it cannot see what a receiver does with the result.
- Recount from scratch. Repeat the tree count with fresh
digqueries. Wait for the TTL to expire before you trust the new value. - Run a public checker to catch syntax errors and any remaining permerror.
- Send a test message from each sending system to a Gmail or Outlook account you control. Open the original headers and find the Authentication-Results header. You want
spf=pass, with thesmtp.mailfromvalue matching the domain you intended. - Watch DMARC aggregate reports for one to two weeks. Look for SPF results on every source, not just your primary sender.
- Schedule a recount monthly, and after every vendor change.
Google's sender requirements expect bulk senders to authenticate with SPF or DKIM and to publish DMARC, so a passing header on Gmail is the most relevant test for most cold email senders.
Bottom line: A passing test message and clean DMARC reports prove the fix. A green checker only proves the DNS looks right.
Where does recipient verification fit in?
SPF proves a sender is authorised. It says nothing about whether recipients exist, and bounces hurt sender reputation whatever your DNS looks like. The two problems are separate, so you need to fix both.
Unlimited Verifier checks recipient addresses, not your SPF record. It runs syntax, domain, MX record and SMTP mailbox checks, flags catch-all, disposable and role-based addresses, and sorts every address into Valid, Risky or Invalid. Use a DNS tool for the SPF count, as described above.
Practical steps for a new subdomain's list:
- Verify before the first send. Export the list as CSV or Excel (up to 10MB), upload and verify it, then re-import only the Valid rows. Keeping email verification compliance and hygiene on a schedule is what stops bounces from creeping back.
- Hold Risky addresses back. Catch-all domains accept any address, so the mailbox cannot be confirmed. The catch-all email verification page explains how these results are handled.
- Spot-check important addresses with the free email checker.
- Automate for scale. The email verification API is part of the wider email verification API and automation approach. It accepts single checks and bulk batches of up to 10,000 emails per request, and Pro includes 100,000 API emails a month.
- Start small if needed. The Free plan covers 25 lists a month of up to 150 emails each, plus 750 deep verifications a month, but it has no API access.
Unlimited Verifier's verification engine is open source on GitHub. The company states 99.5% accuracy for its deep verification. That is the company's own figure, not an independent benchmark.
For wider list hygiene, see email list maintenance best practices and verifying prospect lists for sales. If you are comparing vendors, the best email verification tools entry lists the criteria to check. Once your fix is in place, inbox placement test tools can confirm where your mail lands.
Bottom line: Fix SPF so your domain is authorised, then verify recipients so your bounces stay low. Both are required.
What are the most common SPF lookup mistakes?
- Counting only the top-level record. The hidden cost sits in nested includes, so always count the full tree.
- Flattening once and never re-checking. Vendor IPs change, and the failure is silent.
- Removing an include for a tool that still sends. Check mail logs and the vendor's sending settings before you delete anything.
- Publishing two SPF records on one name. This causes a permerror even when your lookup count is fine. Merge them into one.
- Using
+allor?all.+allauthorises every server on the internet. Use~allor-all. - Keeping the
ptrmechanism. RFC 7208 discourages it, and it still counts toward the limit. - Ignoring the return path. If a subdomain sends with the main domain as its envelope sender, SPF aligns to the wrong identity.
- Assuming a subdomain fully isolates reputation. It helps, but mailbox providers score several identities.
- Leaving parked domains without a null record. An unprotected domain can be spoofed. Publish
v=spf1 -all. - Trusting a cached checker. Confirm against live DNS and a real message header.
Bottom line: Most failures come from counting the wrong tree or from fixing DNS without testing delivery.
How we compared (and limitations)
This guide is based on public documentation: RFC 7208 for SPF, RFC 7489 for DMARC, RFC 1035 for DNS message sizes, and Google's sender requirements. We have not tested these rules against any provider's live records, and the worked example is hypothetical. Public SPF checkers can differ in how they count nested and void lookups, so treat your own tree count as the authority.
Vendor IP ranges, DNS behaviour and receiver handling of permerror change over time, so re-verify before acting on any figure here. Unlimited Verifier's 99.5% accuracy figure is the company's stated number, and its plan details are as listed on its own site.
Worked lookup count
| Source | Lookups |
|---|---|
| include:mailbox.provider (plus 1 nested include) | 2 |
| include:warmup.tool | 1 |
| include:crm.example (plus 1 nested include) | 2 |
| include:helpdesk.tool | 1 |
| include:outreach.tool (plus 2 nested includes) | 3 |
| a (own web host) | 1 |
| Total | 10 |
Total is exactly at the limit. Removing the unused helpdesk include drops it to 9, and moving outreach to a subdomain drops it to 6, leaving headroom.
Frequently asked questions
What is the SPF DNS lookup limit?
The SPF DNS lookup limit is 10. RFC 7208 allows at most 10 DNS-querying mechanisms per SPF evaluation, including nested includes, and at most 2 void lookups that return no records. Exceeding either produces a permerror, which means SPF does not pass.
What is an SPF permerror?
A permerror is a permanent error that stops SPF evaluation. When a record exceeds the 10-lookup limit, the receiver returns permerror, so the message gets no SPF pass. DMARC then depends on DKIM alone.
Do ip4 and ip6 mechanisms count toward the 10 lookup limit?
No. Literal ip4 and ip6 mechanisms need no DNS query, so they do not count. This is why flattening an include into IP addresses reduces your lookup count.
Does the all mechanism count toward the limit?
No. The all mechanism is a terminal qualifier and does not trigger a DNS query, so it does not count toward the 10-lookup limit.
How do I count SPF lookups manually?
Start at your top-level record and count each include, a, mx, ptr, exists, and redirect. Then follow every include and add its lookups recursively. Ignore ip4, ip6, and all. Stop when the total is known, and aim for 8 or fewer.
What is SPF flattening?
SPF flattening replaces include and a mechanisms with the IP addresses they resolve to, written as ip4 and ip6 entries. It removes lookups but must be refreshed when vendors change IPs, so it works best for stable senders.
Should I use subdomains for SPF?
Yes, for high-volume senders. Sending cold email or bulk mail from a subdomain such as mail.example.com with its own SPF record keeps those lookups out of your main domain's record and isolates reputation.
Can I have more than one SPF record?
No. A domain must publish exactly one SPF TXT record. Multiple SPF records cause a permerror, so merge all mechanisms into a single record.
How do I test whether my SPF record passes?
Send a real test message to an inbox you control, open the full headers, and look for spf=pass in the Authentication-Results header. Then monitor DMARC aggregate reports for one to two weeks to confirm the fix holds.
Cut Bounces and Protect Your Sender Reputation With Unlimited Email Verification
Every invalid address you send to hurts your sender reputation and your inbox placement. Verifying your list before each send means fewer bounces, healthier deliverability, and a predictable cost. With Unlimited Verifier, standard verification is unlimited on every plan, with no per-email fees.
Unlimited Verifier checks syntax, domain, MX records and the SMTP mailbox. It also detects catch-all domains and flags disposable and role-based addresses. Export a CSV from your email platform or CRM, upload and verify the list, then re-import the clean results. You can also automate checks with the email verification API.
| Free | Pro | |
|---|---|---|
| Price | $0 | $29/month ($25/month billed annually) |
| Lists | 25 a month, up to 150 emails each | Unlimited, up to 25,000 emails each |
| Deep verifications | 750 a month | 25,000 a month |
| API access | No | Yes (100,000 emails a month) |
| Result retention | 24 hours | 30 days |
Why teams choose Unlimited Verifier
- Unlimited standard verification on all plans, including Free, with no per-email fees.
- Catch-all detection so you know which domains accept every address.
- Clear Valid / Risky / Invalid results, exportable as CSV, Excel or JSON.
- An open-source verification engine you can inspect on GitHub.
Unlimited Verifier states 99.5% accuracy for deep verification.
Create a free account and verify your next list before you hit send.
Want to test a single address first? Try the free email checker.