The spf lookup limit is one of those DNS problems that looks harmless right up until mail starts failing. You add one more sender. One more CRM. One more help desk. Then a normal message gets flagged, delayed, or dropped because your SPF policy crossed a hard protocol limit.
If you want the broader context for how SPF fits into your setup, start with business email. That bigger picture matters. SPF is not a branding checkbox. It is part of the machinery that decides whether your mail is trusted.
This guide gets straight to the point: what the SPF lookup limit is, what counts toward it, why flattening is not the clean fix people claim, and what to do instead if you want a setup that still works next quarter.
What Is the SPF Lookup Limit?
The spf lookup limit is the maximum number of DNS lookups a receiving mail server should perform when checking your SPF record. Under RFC 7208, that limit is 10, and going over it returns a permerror instead of a pass.
The short version: SPF has a budget. Once you spend more than 10 DNS-querying terms, the receiving server is supposed to stop evaluating and mark the result as a permanent error. That is not a Gmail quirk. It is part of the SPF standard.
RFC 7208 is explicit about what burns budget: include, a, mx, ptr, exists, and redirect. Terms like ip4, ip6, and all do not consume lookups during evaluation.
That distinction matters because people often stare at record length instead of lookup cost. A short SPF record can fail. A longer one can pass. The real issue is how many DNS checks it triggers.
What Counts Toward the SPF Lookup Limit?
The spf lookup limit counts DNS-querying mechanisms, not just the number of words in your TXT record. Nested includes count too, so the number you see in your own DNS panel is often lower than the real number a receiver has to resolve.
These terms cost you lookup budget:
include: checks another domain's SPF record.a: resolves a hostname to an IP.mx: resolves MX records, then their addresses.ptr: legacy and best avoided.exists: checks whether a domain resolves.redirect: hands evaluation to another SPF record.
These terms are effectively free during SPF evaluation:
ip4ip6all
Here is the trap: lookup counting is recursive. If your record includes Microsoft, and Microsoft's SPF record includes another record, those downstream queries still count against your total. You inherit your vendors' SPF design whether you like it or not.
You think you added 6 senders. The receiver may have to resolve 11 or 12 lookups after recursion. That is how the SPF lookup limit bites teams that swear they were still under 10.
Why the SPF Lookup Limit Breaks Growing Teams
The spf lookup limit usually breaks after a company adds tools, not after it changes mail hosts. Marketing platforms, support suites, recruiting apps, CRMs, and transactional senders all want an include in the same root-domain SPF record.
Early on, the record is simple:
v=spf1 include:_spf.google.com ~allThen the stack grows:
v=spf1 include:_spf.google.com include:servers.mcsv.net include:mail.zendesk.com include:spf.hubspot.com include:amazonses.com ~allAt that point, you are not managing one sender policy. You are managing a chain of dependencies that can change without notice.
That is why the SPF lookup limit feels random in production. Nothing changed in your DNS this morning, but a vendor changed its internal SPF structure last night. Now mail that passed yesterday returns permerror today.
If your deliverability issue looks bigger than SPF alone, TrekMail's guide on why emails go to spam is a useful second check. Bad authentication and bad reputation often land together.
What Happens When You Hit the SPF Lookup Limit?
When the spf lookup limit is exceeded, SPF evaluation returns permerror. That does not mean every receiver handles the message the same way, but it does mean you have handed them a broken authentication signal instead of a clean pass.
This is where operators get burned. SPF does not fail gracefully. There is no partial credit for getting close.
| State | Receiver sees | Operational outcome |
|---|---|---|
| Under 10 lookups | Valid SPF evaluation | Mail can pass SPF normally |
| Over 10 lookups | Permerror | Mail may be filtered, deferred, or rejected |
| SPF permerror + DKIM fail | No aligned auth path | DMARC can fail hard |
| SPF permerror + DKIM pass | Mixed signal | Mail may still survive, but you are leaning on DKIM |
Google's current sender guidance also ties inbox placement to proper authentication and alignment. If you send to Gmail at scale, you should be watching both SPF and DKIM, not treating SPF as optional plumbing. See Google's email sender guidelines.
There are two related limits worth knowing:
- Void lookups. RFC 7208 says implementations should limit void lookups to two. A typo in an
includeor a dead vendor domain can push you into permerror. - DNS response size. Huge records can trigger truncation and fallback behavior. That can turn into temp errors or timeouts on messy networks.
Why SPF Flattening Is Usually the Wrong Fix
The spf lookup limit pushes people toward flattening because it seems easy: replace includes with raw IP addresses and stop spending lookup budget. That solves one problem while creating another one you now own.
Manual flattening looks like this:
v=spf1 ip4:192.0.2.10 ip4:192.0.2.11 ip4:198.51.100.0/24 -allOn paper, that is cheap for SPF evaluation. In real life, SaaS vendors rotate infrastructure. They add new ranges. They shift providers. If your flattened record is stale, legitimate mail starts failing.
So the old way is this: keep jamming vendors into one root SPF record, then flatten it every time it gets ugly.
The new way is this: move each sending function onto its own subdomain, keep each SPF policy narrow, and let DKIM carry more of the trust path. That is cleaner. It scales. It also makes blame obvious when one sender goes bad.
If you use TrekMail, this architecture is easier to keep sane because you are not paying per mailbox or per domain in the way legacy suites force you to. TrekMail gives you custom domains, IMAP mailboxes, catch-all support, migration tools, mailbox forwarding, and either BYO SMTP or included SMTP depending on plan. On Free you can run BYO SMTP. On paid plans, managed SMTP is included. The DNS side is also documented clearly in required DNS records and the sending options are covered in custom SMTP (BYO).
The Best Fix for the SPF Lookup Limit
The best long-term fix for the spf lookup limit is segmentation. Put corporate mail, marketing mail, support mail, and transactional mail on separate subdomains so each one gets its own SPF budget and reputation boundary.
Here is the model that holds up:
- Root domain for human mail only. Example:
alice@company.com. - Marketing subdomain. Example:
newsletter.company.com. - Support subdomain. Example:
support.company.com. - Transactional subdomain. Example:
updates.company.com.
Example records:
company.com TXT "v=spf1 include:_spf.google.com ~all"
newsletter.company.com TXT "v=spf1 include:servers.mcsv.net ~all"
support.company.com TXT "v=spf1 include:mail.zendesk.com ~all"
updates.company.com TXT "v=spf1 include:sendgrid.net ~all"This is the fix because every subdomain starts with a fresh 10-lookup budget. The SPF lookup limit stops being a shared point of failure for your whole business.
It also gives you a reputation firewall. If marketing burns a list and tanks performance, your root-domain mailbox traffic is not dragged down with it.
If you are setting up domains from scratch, TrekMail's docs on adding a domain and DNS verification make this straightforward. If you are migrating away from a pile of old providers, the built-in IMAP workflow in IMAP migration overview helps you clean up without rebuilding every mailbox by hand.
How to Check Your SPF Lookup Limit
You should measure the spf lookup limit, not guess at it. Start with the raw SPF TXT record, then trace every include and nested include until you know the real count.
Use dig first:
dig txt example.com +short
dig txt _spf.google.com +short
dig txt spf.protection.outlook.com +shortThen count every term that causes a lookup, including anything nested below your own record.
A practical workflow:
- Pull the SPF TXT record for the sending domain or subdomain.
- List every
include,a,mx,exists, andredirect. - Resolve each nested SPF record and repeat.
- Remove tools that do not actually send mail anymore.
- Split senders onto subdomains before you touch flattening.
Also watch for duplicate SPF records. TrekMail calls this out directly in its setup docs: you should merge SPF into one TXT line, not publish separate SPF TXT records for the same host. If you are troubleshooting a messy setup, these related guides help: create email with domain, multi domain email hosting, and imapsync.
TrekMail's Role in a Cleaner Setup
TrekMail does not remove the spf lookup limit. Nobody can. What it does is make it easier to design around that limit with less cost and less account sprawl.
That matters for two audiences.
Solo founders and small teams can keep root-domain mailbox traffic on a simple policy, then use BYO SMTP or managed SMTP where it makes sense. Agencies and MSPs can separate client traffic cleanly, onboard domains in bulk, and avoid the usual per-seat tax that pushes everyone into one tangled domain setup.
Old way vs new way:
Old way: cram corporate mail, aliases, app senders, and marketing platforms into one provider and one SPF record because every extra mailbox or domain costs more.
New way: use a flat-rate, multi-domain platform, keep IMAP mailboxes centralized, split senders by subdomain, and keep each SPF record small enough to survive vendor churn.
TrekMail starts at $3.50/month on Starter. Free is $0 with 10 domains, 5GB pooled storage, and BYO SMTP. Paid plans add managed SMTP, higher limits, and more automation. If you want to price out a cleaner architecture, see TrekMail pricing.
Conclusion: Treat the SPF Lookup Limit Like a Design Constraint
The spf lookup limit is not a corner case. It is a hard design constraint in modern email. If your stack is growing, assume you will hit it unless you plan around it.
Do not wait for a permerror to tell you your policy is too crowded. Audit your senders. Remove dead includes. Split traffic onto subdomains. Keep your root domain boring. That is how you stop the SPF lookup limit from quietly breaking mail that your business depends on every day.
If you want a simpler way to run that architecture across one domain or hundreds, TrekMail gives you the core pieces without the per-user tax: custom domains, IMAP mailboxes, pooled storage, built-in migration, and flexible SMTP choices. Start free at trekmail.net or compare plans at trekmail.net/pricing.