SPF permerror: too many DNS lookups (how to fix it)
An SPF record may cause no more than 10 DNS lookups when a receiving server checks it. Go over that and the check returns a permanent error (permerror), so your SPF effectively fails. The fix is to remove unused services from the record or move senders elsewhere until it is at 10 or fewer.
SPF is a DNS record that lists which services may send email for your domain. When a receiving mail server checks it, it follows every include: and similar entry, and each one costs a DNS lookup. The rules allow 10 in total. If your record needs 11 or more, the receiver stops and reports permerror.
Most owners never see this directly. Mail just lands in spam more often, or a DMARC report shows SPF failing for mail you know is legitimate. You may also see it in an SPF checking tool as a red message such as "Too many DNS lookups" or "SPF permerror".
Why it matters
A permerror means SPF cannot vouch for your mail. What happens next depends on the receiver, but many treat it like a failed check. If your DKIM signature is also missing or misaligned, DMARC fails too, and that is when invoices, quotes and password resets start going to spam or get rejected.
This problem builds up slowly. Every new tool that sends email for you (a newsletter service, a CRM, a helpdesk, an invoicing app) asks you to add another include:. Nothing breaks until the record crosses the limit, usually right after you add one more service. The same tools are often the ones that have the least obvious effect on deliverability, so the first sign is a customer saying they never got your email.
Since 2024, Google and Yahoo expect bulk senders to authenticate properly, so a broken SPF record is worth fixing quickly. See Gmail and Yahoo bulk sender requirements for the wider picture.
What counts as a lookup
These entries each cost one lookup, and so does everything nested inside them:
include:(and whatever that included record itself includes)aandmx(anmxentry also triggers a lookup for each mail server name it returns)exists:redirect=ptr(old, and best removed entirely)
These do not cost anything: ip4:, ip6: and all.
The nesting is what catches people. One include: for a big provider can use several lookups on its own, because their record points to other records. So a record with only five or six include: entries can still go over 10.
A second, less known rule: if more than two lookups return nothing at all (an include: pointing to a domain that no longer exists, for example), that can also cause a permerror.
How to check your record
You can do this for free in a few minutes.
- Look up your current record. In a terminal, run
dig +short TXT yourdomain.comand find the line starting withv=spf1. On Windows,nslookup -type=TXT yourdomain.comdoes the same. - Paste your domain into a free SPF checker such as MxToolbox's SPF lookup, Kitterman's SPF validator or dmarcian's SPF Surveyor. They count the lookups, including nested ones, and flag errors.
- Make sure you have only one SPF record. Two separate TXT records starting with
v=spf1is its own permerror, and the fix is to merge them into one.
A typical over-limit record looks like this:
v=spf1 include:_spf.google.com include:servers.mcsv.net include:spf.protection.outlook.com include:sendgrid.net include:mail.zendesk.com include:_spf.crm.example ~all
Six entries, but the nested lookups behind each one can push the total past 10.
How to fix it
The goal is to get to 10 or fewer, with a little room to spare. Work through these in order.
- List who really sends your email. Check each
include:and ask whether you still use that service. Old newsletter tools, past web agencies and trial accounts are the usual leftovers. Remove anything unused. Also remove entries that point to domains that no longer exist. - Remove `ptr`, and trim `a` and `mx`. If your website and mail server are not sending mail, you do not need them in the record.
- Check for duplicates. Two services often include the same provider, so you pay for the lookup twice.
- Move some senders to a subdomain. Mail from a marketing tool can go out as
news.yourdomain.com, which gets its own SPF record and its own 10 lookups. Most services let you set this up in their domain authentication settings. - Rely on DKIM for third party tools. Many services can sign mail with your domain using DKIM, so you can pass DMARC even if they are not in your SPF. See DKIM not set up if you have not done this.
- Replace an include with fixed IP addresses (only if needed). This is called flattening. You swap an
include:for theip4:ranges behind it. It works, but providers change their addresses without telling you, and your record then silently goes stale. If you do this, use a service or script that refreshes it automatically, and do not hand edit it once and forget.
A cleaned up record might look like this:
v=spf1 include:_spf.google.com include:sendgrid.net ~all
Edit the existing TXT record rather than adding a second one.
Where to make the change
SPF lives wherever your DNS is managed, which is not always where you bought the domain. It is usually under a section called DNS, DNS records or Zone editor, on your registrar, host or DNS provider. Changing it is the same everywhere: find the TXT record starting with v=spf1, edit it, save.
Platform specific steps are here:
Namecheap, HubSpot CMS and cPanel have their own guides under /fix/spf-too-many-dns-lookups/.
If you are not comfortable editing DNS, send the checker results to whoever manages your domain. A wrong edit can break all your email, so keep a copy of the old record before changing it.
Confirm the fix worked
DNS changes can take from a few minutes to a few hours to show up, depending on the record's TTL (the time other servers cache it).
- Run the same SPF checker again. It should show a valid record with 10 or fewer lookups and no errors.
- Send a test email from each service you use to a Gmail address. Open the message, choose Show original, and look for
SPF: PASS. - Watch your DMARC reports for a week or two. SPF failures from services you know should drop away. If you have no reporting set up, see DMARC with no reporting address.
Stop it coming back
- Before connecting a new email sending tool, check how many lookups your record uses now.
- Keep a short list of every service allowed to send for your domain, and who added it.
- Remove a service from SPF when you stop using it, not just from your account.
- Prefer subdomains for bulk or marketing mail.
- Re-check your record every few months, and after any change to your email setup.
SiteMonday's week 10 service (domain, SSL and email deliverability) checks your SPF record as part of its report, and flags a lookup count over the limit in the ranked fix list. See week 10 for what that week covers. SiteMonday finds and explains the problem, and the change itself is made by you or your developer.
Step by step for your platform
- SPF record exceeds 10 DNS lookups on Google Workspace
- SPF record exceeds 10 DNS lookups on Microsoft 365
- SPF record exceeds 10 DNS lookups on Cloudflare
- SPF record exceeds 10 DNS lookups on GoDaddy
- SPF record exceeds 10 DNS lookups on Namecheap
- SPF record exceeds 10 DNS lookups on HubSpot CMS
- SPF record exceeds 10 DNS lookups on cPanel
Questions
What is the SPF 10 lookup limit?
It is a rule that a receiving server will follow no more than 10 DNS lookups while evaluating your SPF record. Going over returns a permerror, which means the SPF check cannot give a valid result.
Does a permerror stop my email being delivered?
Not always, but it can. Receivers decide for themselves, and many treat it as a failed SPF check, which raises the chance of spam folder placement or rejection, especially if DKIM and DMARC are not passing either.
Do ip4 and ip6 entries count as lookups?
No. `ip4:`, `ip6:` and `all` need no DNS lookup, so they do not count toward the limit. Entries like `include:`, `a`, `mx`, `exists:` and `redirect=` do.
Can I just add a second SPF record for the extra services?
No. A domain must have only one SPF record, and two records starting with `v=spf1` cause a permerror of their own. Merge everything into a single record instead.
Is SPF flattening safe?
It can be, but only if the flattened record is kept up to date. Providers change their IP addresses, so a record edited by hand once will eventually block real mail. Use a tool that refreshes it automatically, or try other fixes first.
How long until the fix takes effect?
Usually minutes to a few hours, depending on the TTL of your DNS record. Re-run an SPF checker after that to confirm the record is valid and under 10 lookups.