Black Friday: 60% off yearly plans with code BF2026, until November 30. See the deal

Troubleshooting

SPF too many lookups: how to fix it

The error means your SPF record triggers more than 10 DNS-querying terms (include, a, mx, ptr, exists, redirect), so receivers stop and return permerror. Fix it by removing unused includes, replacing a and mx with ip4 ranges, or moving senders to subdomains.

The short answer
  • Limit is 10 DNS-querying terms per check, including lookups inside nested includes.
  • Beyond 10 the result is permerror, which DMARC treats as an SPF failure.
  • ip4, ip6, all and exp do not count. Flattening to ip4 saves lookups but needs upkeep.
Try the spf record checkerFree, live, no signup

How do you get back under 10 lookups?

  1. 01

    Count every term

    Run the SPF checker and expand each include. Add up include, a, mx, ptr, exists and redirect, including nested ones.

  2. 02

    Delete dead senders

    Remove includes for services you no longer use. This is the cheapest fix.

  3. 03

    Drop ptr and exists

    RFC 7208 says ptr should not be published. Replace it with explicit ip4 or ip6 ranges.

  4. 04

    Replace a and mx with addresses

    If your own server sends mail, list its ip4 or ip6 directly.

  5. 05

    Split senders by subdomain

    Send newsletters from news.example.com with its own SPF record and its own 10-lookup budget.

  6. 06

    Flatten only as a last resort

    Copying a vendor ip4 list into your record works until the vendor changes its IPs. Use a service that refreshes it.

Which terms count against the limit?

RFC 7208, section 4.6.4
TermCountsNote
include, a, mx, ptr, exists, redirectYesEach one is a lookup. Nested ones inside an include also count.
ip4, ip6NoPure address match, no DNS query
all, expNoNot counted
Each MX host returned by mxYesEvery MX queried counts toward the 10, and one mx term may query no more than 10 addresses

Limits in the specification

10

DNS-querying terms allowed per SPF evaluation

Source: RFC 7208, 4.6.4

2

void lookups (empty or NXDOMAIN answers) before permerror is recommended

Source: RFC 7208, 4.6.4

255

octets in a single TXT character-string; longer records are split into strings

Source: RFC 7208, 3.3

Void lookups also fail you

An include that points to a domain with no TXT record returns an empty answer. RFC 7208 recommends permerror after two of these, so a stale include to a vendor you dropped can break the whole record.

Which senders usually push you over?

Stacked vendors

A suite mail platform, a CRM, a help desk, an invoicing app and a newsletter tool can each add one or more includes.

Old a and mx terms

Added years ago for a server that no longer sends. Each costs a lookup, and mx can add one per MX host.

Vendors that nest

An included record can itself contain includes. You pay for all of them even though you only wrote one.

How do you confirm the fix worked?

  • The SPF checker shows a total at or below 10 DNS-querying terms
  • Only one v=spf1 record is returned for the name
  • No void lookups (includes that return nothing)
  • A test message shows spf=pass in Authentication-Results
  • The sender you moved to a subdomain has its own SPF record there

Common questions

What happens when SPF exceeds 10 lookups?

The receiver returns permerror. Because permerror is not a pass, DMARC cannot use SPF for alignment, and mail then depends on DKIM alone. Some receivers treat it like a fail.

Do nested includes count toward the limit?

Yes. The limit counts every DNS-querying term evaluated in the whole chain, so a single include of a large provider can consume several lookups by itself.

Does the ip4 mechanism use a DNS lookup?

No. ip4 and ip6 compare the sending address directly and need no DNS query, which is why replacing a, mx or include with address ranges reduces the count.

Is SPF flattening a good idea?

It solves the limit but freezes vendor IP lists in your record. When a vendor adds addresses, mail from them fails until you update. Use it only with automated refresh.

How many lookups is too many for SPF?

More than 10 DNS-querying terms in a single evaluation. RFC 7208 counts include, a, mx, ptr, exists and redirect, including those inside included records. ip4, ip6 and all do not count.

Can I split an SPF record into two TXT records to avoid the limit?

No. Two v=spf1 records on the same name cause permerror. Use subdomains for separate senders, or reduce lookups inside the single record.

Watch your domains automatically

Aepto monitors expiry, DNS, SSL and uptime for every domain you own and alerts you when something changes. Free for 3 domains.