Skip to main content
WebTools

SPF 10-lookup limit: how to fix "too many DNS lookups"

Why SPF stops at 10 DNS lookups, how includes add up behind the scenes, and safe ways to get your record back under the limit.

Published

Illustration of a branching tree of connected points growing from an envelope, with one branch highlighted as going too far.
On this page

The short answer: receivers stop checking an SPF record after 10 DNS lookups. Each include, a, mx, ptr, exists and redirect counts, including the ones hidden inside the records you include. Go over 10 and SPF returns a permanent error, which usually means it fails for all your mail. The fix is to remove senders you no longer use, replace lookups with ip4/ip6 ranges where a service allows it, or move some senders to a subdomain.

This guide explains how the limit is counted, how to find where your lookups go, and the safe ways to get back under it.

What the 10-lookup limit is

SPF is defined in RFC 7208. To protect receiving servers from records that trigger endless DNS queries, section 4.6.4 sets a hard limit: evaluating a record may cause at most 10 terms that need DNS lookups. If a record needs more, the result is permerror.

The terms that count are:

  • include:, which also counts everything inside the included record;
  • a and mx;
  • ptr, which you should avoid anyway, as the standard discourages it;
  • exists:;
  • redirect=.

The terms that don't count are ip4:, ip6: and all. These are free because the receiver doesn't need to look anything up.

Tree diagram of an SPF record with four includes. One include contains three more includes, bringing the total to 11 lookups, one over the limit of 10.
Lookups inside included records count towards your total.

Why records go over the limit

Most records start small. The problem builds up as a business adds services: email hosting, a newsletter platform, a help desk, a CRM, an invoicing tool. Each service asks you to add its include:, and each include may contain several more.

For example, a record like this looks like it has five lookups:

v=spf1 include:spf.protection.outlook.com include:_spf.example-newsletter.com include:mail.example-helpdesk.com mx a -all

But if the newsletter platform's record includes three more records of its own, and the help desk's includes two, the real total is ten. One more service tips it over.

Services also change their records without telling you. A record that was at nine lookups last year can be at eleven today.

Try it now

SPF Checker

Check a domain's SPF record: syntax, the 10 DNS-lookup limit across every include, void lookups, and what the "all" setting means.

Open the tool: SPF Checker

How to find out where your lookups go

  1. Run your domain through the SPF Checker. It follows every include and shows the total count and the tree of records behind it.
  2. Note which includes use the most lookups. Large email platforms often use three or four each.
  3. Look for mx and a terms. They are often left over from years ago and may not be needed.
  4. Look for includes that find nothing (void lookups). These usually belong to services you have stopped using.

Safe ways to fix "too many DNS lookups"

Work through these in order. The first ones are the safest.

1. Remove services you no longer use

Ask around: does anyone still use that old marketing tool or the previous email host? Removing an unused include is the simplest fix and makes your record easier to understand.

2. Remove unnecessary mx and a terms

The mx term authorises your incoming mail servers to send mail. If you use Microsoft 365 or Google Workspace, those servers are already covered by the provider's include, so mx is usually redundant (Microsoft's own SPF set-up guide uses just include:spf.protection.outlook.com). The same goes for a unless your website server really does send mail as your domain.

3. Use ip4 and ip6 where a service gives fixed addresses

Some services, often smaller ones or your own servers, send from a small, fixed set of addresses. If the service documents those addresses and promises to keep them, you can list them with ip4: or ip6:, which cost no lookups.

4. Move some senders to a subdomain

Marketing and transactional platforms can often send from a subdomain such as news.yourdomain.com. That subdomain has its own SPF record with its own limit of 10, so your main domain's record gets shorter. This also keeps your main domain's reputation separate from bulk mailings.

5. Rely on DKIM for services that support it

DMARC passes when either SPF or DKIM passes and aligns with your From domain. If a service can sign mail with DKIM for your domain, DMARC can pass on DKIM alone. Some services that send from their own bounce domains don't need to be in your SPF record at all. Check each service's documentation before removing it.

What happens when SPF fails with a permerror

A permanent error isn't the same as a soft fail. Receivers treat it differently, but many treat it as a fail. With a DMARC policy of quarantine or reject, mail that relies on SPF for DMARC can then go to spam or be refused.

Because the limit is applied while the receiver evaluates your record, you won't see an error when you save the record at your DNS host. Your DNS host has no way to know. The first sign is often mail going missing or DMARC reports showing SPF failures for every sender.

Try it now

DNS Lookup

Look up the DNS records for a domain: A, AAAA, CNAME, MX, NS, TXT, SOA and CAA, or the reverse DNS (PTR) name of an IP address.

Open the tool: DNS Lookup

A worked example

Suppose your record is:

v=spf1 mx a include:spf.protection.outlook.com include:servers.mcsv.example include:_spf.oldcrm.example include:mail.helpdesk.example -all

The SPF Checker shows 12 lookups, and _spf.oldcrm.example no longer exists (a void lookup). A tidy-up might look like this:

  1. Remove include:_spf.oldcrm.example: the CRM was replaced last year.
  2. Remove mx and a: mail is in Microsoft 365, and the website uses an email service to send its contact form.
  3. Move the newsletter platform to news.yourdomain.com with its own SPF record and DKIM.

The result:

v=spf1 include:spf.protection.outlook.com include:mail.helpdesk.example -all

That is well under the limit, with room for future services.

Common questions

Can I just publish two SPF records to get 20 lookups?

No. A domain with two SPF records gives a permanent error straight away, before any lookups are counted. Receivers must find exactly one record that starts with v=spf1. Combine everything into one record.

Is ~all or -all better?

-all (fail) says mail from anywhere else is not authorised. ~all (soft fail) says it probably isn't. Once DMARC is in place, receivers mostly act on your DMARC policy rather than the difference between the two, so either works. -all is the clearer statement once you're sure your list of senders is complete.

Does the limit apply to my provider's record too?

Yes. When you include a provider's record, its lookups become part of your total. You can't change the provider's record, which is why moving a heavy sender to a subdomain is often the most practical fix.

Why does one checker say 9 and another say 11?

Some tools only count the terms in your own record, not those inside included records, and some ignore redirect or void lookups. The standard counts everything that needs a lookup during evaluation, at every level. Our SPF Checker follows the whole tree, the way a receiving server does.

Checklist

  • One SPF record per domain or subdomain, never two.
  • Total lookups 10 or fewer, counted through every include.
  • No more than two void lookups; remove includes for services you've left.
  • No ptr term.
  • Ends with -all or ~all once you're confident the list is complete.
  • DKIM set up for each service that supports it.

Run the SPF Checker again after every change. The record is public, so the check reads only what any receiving mail server would see.

  • SPF Checker

    Check a domain's SPF record: syntax, the 10 DNS-lookup limit across every include, void lookups, and what the "all" setting means.

  • DNS Lookup

    Look up the DNS records for a domain: A, AAAA, CNAME, MX, NS, TXT, SOA and CAA, or the reverse DNS (PTR) name of an IP address.