SPF Record Exceeded 10 DNS Lookups: What It Means and Fix
SPF allows at most 10 DNS-querying terms per check (RFC 7208). Past that, receivers return a permerror and SPF fails. Count your include, a, mx, ptr, exists and redirect terms, delete services you no longer send from, then flatten or split what remains, and republish one record.
Sohail Hussain10 min readShort answer
- Your SPF record needs more than 10 DNS lookups once every nested include is counted, so receivers can return a permerror and SPF fails.
- Count the full include tree, delete includes for services you no longer send from, and move the rest to subdomains or flatten only the stable ones.
- Edit your one existing SPF TXT record in Cloudflare under DNS > Records. Do not add a second one.
You are seeing this warning in Cloudflare:
Your SPF record has exceeded 10 DNS lookups limitations. This might cause security issues.
It means the SPF record on your domain triggers more than 10 DNS lookups when a receiving server evaluates it. Cloudflare is only flagging the record; it publishes whatever you put there. People on Cloudflare's community forum report the same warning, and the thread does not show a specific fix, so the steps below come from the SPF standard and provider documentation.
Why it happens
The limit is 10 DNS-querying terms per SPF check. The mechanisms include, mx, a, ptr and exists count against the limit. The redirect modifier counts too. The all, ip4 and ip6 mechanisms do not count, because they need no DNS lookup.
The usual causes, most common first:
- Nested includes. If your record includes a domain and that domain includes other domains, those count toward your limit. Microsoft's documentation makes the same point: having fewer than 10
include:statements doesn't guarantee fewer than 10 DNS lookups. - Leftover includes. Tools you trialed, replaced or cancelled still sit in the record.
- Too many sending services on one domain. Mailbox provider, marketing tool, CRM, helpdesk and billing system add up fast.
mxandaterms you don't need. Each costs a lookup, and most domains don't send from their own MX hosts.- A provider changed its own record. If you are near the limit and someone you include adds records to their SPF, you can go over. Your record did not change, but your count did.
There is a second, smaller limit: an mx mechanism may not resolve to more than 10 address records, or it produces a permerror. SPF also tolerates only 2 "void" lookups, meaning queries that return nothing, such as an include pointing at a domain with no SPF record.
What actually happens at 10: the message fails SPF with a permanent error, also called a permerror. DMARC treats that as an SPF failure. If the message also lacks a passing, aligned DKIM signature, it can be rejected or sent to spam. That is the "security issue" in the warning. Microsoft also notes that validation of some mail sources by some destinations may not go deep enough in the record to hit the error, so the failure can look intermittent.
Step-by-step fixes
Fix 1: Count the real lookups
- Get your current record with
dig TXT example.com +short, or any DNS lookup tool. - For each
include:, query that domain's TXT record and note what it contains. - Repeat for any includes inside those, until you reach only
ip4,ip6andall. - Add up every counted term across the whole tree.
The SPF lookup count calculator helps with the arithmetic. A record like this looks modest:
example.com. IN TXT "v=spf1 include:_spf.google.com include:sendgrid.net include:servers.mcsv.net include:spf.protection.outlook.com include:_spf.salesforce.com mx -all"
Five includes plus mx is six on the surface. Once each provider's nested includes are resolved, it can pass 10 easily.
Fix 2: Remove senders you no longer use
This is the best fix because it costs nothing and needs no upkeep.
- List every service that genuinely sends mail as your domain.
- If you publish DMARC with a
ruaaddress, read the aggregate reports and note which sources actually send. A source absent for several weeks is a removal candidate. - Delete the matching
include:terms. - Drop
mxunless you really send from your MX hosts.
Ask around before deleting anything you can't identify. A forgotten invoicing tool that quietly sends receipts is the usual casualty.
Fix 3: Move some senders to subdomains
Each subdomain has its own SPF record and its own 10-lookup budget. Microsoft recommends this: move non-Microsoft email services to subdomains, for example marketing.contoso.com with its own SPF record. Postmark's guidance is the same for its own mail stream: a subdomain gives it a fresh SPF record with its own 10-lookup limit, separate from your corporate email.
example.com. IN TXT "v=spf1 include:_spf.google.com -all"
news.example.com. IN TXT "v=spf1 include:sendgrid.net -all"
mail.example.com. IN TXT "v=spf1 include:servers.mcsv.net -all"
Then set each service to use its subdomain as the envelope sender and, ideally, the From domain. This takes more setup and may change From addresses, but it is the sturdiest option when you have many senders.
Fix 4: Lean on DKIM for some third-party senders
DMARC needs only one of SPF or DKIM to pass and align. If a service signs with a DKIM key for example.com, its SPF include may be redundant for DMARC. Some providers also use their own domain as the envelope sender, so SPF is checked against their domain and your record is irrelevant for that mail.
Before removing an include, send a real message from that service and run the headers through the email header analyzer. Look for dkim=pass with header.d=example.com. SPF still matters to some receivers, so do this only for services whose DKIM you have confirmed.
Fix 5: Flatten what is left, carefully
Flattening replaces include: terms with the literal ip4: and ip6: ranges they resolve to. IP terms cost no lookups. Microsoft lists it as an option when you are near or over the limit and subdomains or consolidation aren't feasible.
The risk is real: a flattened record is a snapshot. When the provider adds a range, your record silently stops authorizing it and mail fails SPF until someone notices.
- Flatten only providers that document a small, stable list of ranges.
- Leave large, changing ones (Google Workspace, Microsoft 365) as
include:. - A dynamic flattening service hosts a record it keeps updated and you include it. That puts a third party in your authentication path, so weigh that.
- Set a recurring reminder to re-resolve and republish manual ranges.
example.com. IN TXT "v=spf1 include:_spf.google.com ip4:203.0.113.0/24 ip4:198.51.100.10 -all"
Do not loosen the ending
Keep -all or ~all at the end. Switching to +all or deleting the all term silences nothing useful and lets anyone send as your domain. The warning is about lookup count, not the qualifier.
Publish the change in Cloudflare
- Open your domain in the Cloudflare dashboard and go to DNS > Records.
- Find the existing
TXTrecord whose content starts withv=spf1. - Edit that record. You can't have more than one SPF TXT record for a domain. Two records cause a permerror of their own.
- Save, then wait for caches to expire. Receivers may hold the old record until its TTL runs out.
- Re-count the lookups, then send a test message and check for
spf=passin the headers.
A single TXT string is limited to 255 characters. Longer records are split into several quoted strings inside the same record, which most DNS interfaces do for you; check that yours does. Microsoft's page on connecting DNS records at Cloudflare shows where the Add record button sits and repeats the single-record rule.
Which cause matches your symptom
| Cause | What you see | Fix |
|---|---|---|
| Nested includes | Few includes in the record, count still over 10 | Fix 1, then 2 or 3 |
| Cancelled tools still listed | Includes for services you can't name | Fix 2 |
| Many active senders | Every include is needed | Fix 3 (subdomains) |
Unneeded mx or a | Mail is sent only by third parties | Remove the term |
| Two SPF records | Permerror even with a short record | Merge into one |
| Provider added includes | Record unchanged, count rose | Re-count; Fix 3 or 5 |
Checklist before you republish
- Only one
v=spf1TXT record exists at the domain. - The full include tree resolves to 10 lookups or fewer.
- Every service that really sends mail is still authorized, by SPF or by aligned DKIM.
- The record ends in
-allor~all. - A test message shows
spf=pass(ordkim=passfor the DKIM-only senders).
How to keep it from coming back
Count the lookups a new service's include adds before you publish it. Keep an inventory of who sends as your domain and review it whenever you cancel a tool. Publish DMARC with a rua address so reports reveal forgotten sources. Our SPF, DKIM and DMARC setup guide covers the wider picture, and Google's SPF troubleshooting page covers the same lookup limit from the Workspace side.
If nothing works
If the count is under 10 and the warning stays, check for a cached record (wait out the TTL) and for a second SPF record. If you still see failures, contact Cloudflare support or, for a specific sender's include, that sender's support team. Include the exact warning text, your domain, the full record, your lookup count and what you already tried.
Subject: SPF lookup limit warning on {your-domain}
Cloudflare shows: "Your SPF record has exceeded 10 DNS lookups limitations.
This might cause security issues."
Domain: {your-domain}
Current SPF TXT record: {paste the full record}
Lookup count after resolving all includes: {number}
Changes made: {what you removed, split or flattened, and when}
Test result: {SPF result from the message headers}
Can you confirm whether the warning reflects the current record,
and whether anything else on the zone could be adding an SPF record?
Where Mailneo fits
This lives in your DNS, and Mailneo can't change your DNS. For connected accounts, Mailneo looks up your sending domain's SPF (including the include chain), DKIM and DMARC records and checks whether they authorize the provider you're using, so it can point out what needs fixing. You make the change at your DNS host. We don't have an SPF flattening tool; for counting and building records, use the free tools linked above. See email accounts for details.
Common questions
Does the warning mean my email is failing right now?
Not necessarily. Whether a given message fails depends on which source sends it and how deep the receiver's evaluation goes. Treat it as a fault to fix before it hurts, since a provider changing its own record can tip you over.
Can I just use two SPF records?
No. Two records at the same name produce a permerror, which is worse than the lookup problem. Merge everything into one record, or use subdomains for separate streams.
Does the SPF generator flatten includes for me?
No. The SPF generator builds a record from values you give it. It does not resolve or flatten includes.
Is flattening or subdomains the better fix?
Subdomains need more setup but need no maintenance. Flattening is faster but goes stale when providers change their ranges, so use it only for stable ones.
Explore: Email Deliverability
Related Articles
0x800ccc0e: Outlook Unable to Connect to SMTP Server, Fixed
Outlook error 0x800ccc0e means the app could not open a connection to your outgoing (SMTP) server. Usually the port, encryption setting or password is wrong, or antivirus, a firewall or your ISP is blocking it. Set port 587 with STARTTLS, turn on SMTP authentication, and test again.
SocketLabs "421 4.5.1 Too many errors" blacklist: how to fix it
`421 4.5.1 Too many errors, you have been temporarily blacklisted` means a SocketLabs server saw repeated auth or bad-address errors from your IP and paused it. Stop whatever is retrying, fix credentials and invalid recipients, clear the queue, and wait. The block usually lifts within minutes, but returns if retries resume.
421-4.7.0 Gmail Has Detected This Message Is Suspicious: Fix
The 421-4.7.0 "suspicious due to the nature of the content and/or the links" error means Gmail's content filter rejected your message after DATA, not an authentication check. Remove click tracking or move it to your own domain, drop URL shorteners, check link reputation, then retest with a plain message.
421 4.7.0 IP not in whitelist for RCPT domain: what it means
The error 421 4.7.0 IP not in whitelist for RCPT domain means the recipient's mail gateway, usually Mimecast in reports, only accepts connections from approved IPs, and the Google sending IP isn't on that list. The fix is on the recipient side: their admin must allow the IPs or change the mail routing.
Ready to supercharge your email marketing?
Start sending smarter emails with AI-powered campaigns. No credit card required.
Get Started Free