Skip to content
dnscheck.app

Guides

SPF Too Many DNS Lookups: What It Means and How to Fix It

Updated 22 November 2026

What "too many DNS lookups" means and what receivers do with it

SPF (Sender Policy Framework) is a DNS record that lists which servers are authorized to send email for your domain. An SPF evaluation may use at most 10 DNS-querying terms in total. Going over that limit returns permerror. A permerror is a permanent error: the published records could not be correctly interpreted, and a DNS operator has to fix them. The limit covers the whole evaluation, not each record on its own.

The terms that cost a lookup are references to other names, such as include: (a mechanism that pulls in another domain's SPF record) or mx. Each such reference needs a separate DNS lookup. Services you add over the years each bring their own references, which is why the error often appears right after you add one more sender.

Handling varies by receiver. A receiving mail server may treat the check as a permanent error and reject or flag the message. Microsoft's documentation says that when evaluation exceeds 10 lookups, the message fails SPF with a permerror and the destination system rejects it with a non-delivery report (NDR). Treat that as Microsoft's described behavior, not as something every receiver does.

DMARC adds a second consequence. DMARC requires that either SPF or DKIM passes and that the passing domain aligns with the domain in the From address. An SPF pass alone is therefore not a DMARC pass. SPF and DKIM can both pass while DMARC fails, if neither passing domain matches the From domain. For how DMARC acts on SPF failures, see how DMARC policy handles SPF failures.

To confirm the symptom, check your SPF record and its lookup count. An SPF record is published as a TXT record at the domain name and starts with v=spf1. See what an SPF record is if you need the basics.

example.com.  3600  IN  TXT  "v=spf1 mx ip4:192.0.2.10 -all"

Which SPF mechanisms count toward the 10-lookup limit

RFC 7208 says implementations MUST limit the total number of DNS-querying terms to 10 and MUST return permerror when the limit is exceeded. The terms are the include, a, mx, ptr and exists mechanisms and the redirect modifier.

Term Counts toward the 10? Note
include: Yes One lookup, plus more if the target record nests further terms.
a Yes One lookup.
mx Yes The MX records queried count toward the overall limit. Each MX record's evaluation MUST NOT query more than 10 address records, or the result is permerror.
ptr Yes The PTR records queried count toward the overall limit. Address-record lookups beyond the first 10 per PTR record are ignored, not treated as an error.
exists Yes One lookup.
redirect Yes One lookup.
ip4:, ip6: No No DNS query at evaluation time.
all No No DNS query at evaluation time.
exp modifier No No DNS query at evaluation time.

The per-mechanism limits for mx and ptr are in addition to the overall limit, not instead of it.

Two more rules affect how you read a record:

  • Mechanisms listed after all MUST be ignored. Any redirect modifier MUST be ignored when an all mechanism is present.
  • A syntax error anywhere in the record makes the evaluation return permerror immediately, without further evaluation. Check the syntax before you start counting.

Good practice, from RFC 7208's advice to publishers: publish records that stay within the receiver limits, and reduce DNS cost by choosing cheaper directives and placing lower-cost mechanisms earlier. This is guidance for publishers, not a requirement.

How to count the lookups in your own SPF record

Check your SPF record and its lookup count first. Free online tools can display your SPF record, and some calculate how many DNS lookups it needs. To count by hand, follow the steps below.

Step 1: Read the published record

Query the TXT records and look for the one that starts with v=spf1:

dig TXT example.com +short

The answer is a quoted string for each TXT record at the name. Your SPF record is one quoted line starting with v=spf1:

"v=spf1 mx a include:_spf.vendor-a.example.net include:spf.vendor-b.example.org include:mail.vendor-c.example.net ip4:192.0.2.10 -all"

You can also look up the TXT records on your domain. Write down the record before you change anything.

Add one for every counting term: include, a, mx, ptr, exists and redirect. Add nothing for ip4, ip6 and all.

Step 2: Follow every include

To check an include: entry, query the TXT record of the domain it names. Count every counting term in that record too, and open any further include: targets in it. Each include: needs at least one lookup, and more if it nests others. For that reason, fewer than 10 include: statements does not guarantee fewer than 10 lookups. An include that points to a record with three more includes adds four lookups.

Worked example: a record with nested includes

The vendor names below are illustrative. The record at example.com is the one shown in Step 1. Only three include: statements appear in it, yet the total is over the limit:

example.com
├─ mx                                          1   running total  1
├─ a                                           1   running total  2
├─ include:_spf.vendor-a.example.net           1   running total  3
│    └─ 3 nested include: terms                3   running total  6
├─ include:spf.vendor-b.example.org            1   running total  7
│    └─ 1 nested include: term                 1   running total  8
├─ include:mail.vendor-c.example.net           1   running total  9
│    ├─ nested mx                              1   running total 10
│    └─ nested include: term                   1   running total 11
├─ ip4:192.0.2.10                              0
└─ -all                                        0

The total is 1 + 1 + 4 + 2 + 3 = 11. That is over the limit of 10, so the result is permerror.

The cost of a real provider's include is not fixed. Expand your own chain with the checker instead of relying on someone else's number.

How to fix SPF too many DNS lookups, from least to most risky

Copy the current record to a safe place before you edit it. Keep that copy until the new record is verified, so you can roll back. Do not publish the old and new records side by side. That creates a different error (see the section on two SPF records below). Work through the steps in order and recount after each one.

Step 1: Remove senders you no longer use

Remove unnecessary entries from the record. Microsoft's documentation also advises reducing the number of non-Microsoft services that send mail from your domain, if possible. Old marketing tools and retired support desks are the usual candidates.

In the worked example, vendor B is retired. Removing its include removes 2 lookups, so the total is 11 - 2 = 9, within the limit:

example.com.  3600  IN  TXT  "v=spf1 mx a include:_spf.vendor-a.example.net include:mail.vendor-c.example.net ip4:192.0.2.10 -all"

Step 2: Combine services in one record

Combine multiple services in a single SPF record with separate include: statements, not separate records. A correct record is one v=spf1 record with several include: entries followed by an all mechanism. Merging does not lower the lookup count, but it avoids the permerror that

References

Check it yourself

  • SPF

    Syntax, the include tree, and the 10-lookup limit.

  • TXT lookup

    TXT records, including SPF and site verification strings.

  • Propagation

    What more than 30 public resolvers return, next to the authoritative answer.