What happens when an SPF record exceeds DNS lookup limits?

Still have a question, spotted an error, or have a better explanation or a source we should cite?

SPF has a hard cap: 10 DNS lookups during evaluation. Every include, a, mx, ptr, or exists mechanism counts, and some of them chain into further lookups you can't see from the outside. Cross that limit and SPF returns a permerror.

Permerror means the receiving server can't finish evaluating your record. Most mailbox providers treat a permerror the same as a fail. Your authentication doesn't pass, DMARC can't align on SPF, and deliverability takes a hit even for your legitimate mail.

Why 10?

But The limit lives in the SPF spec (RFC 7208) to protect DNS infrastructure from recursive lookup loops and amplification attacks. It's not arbitrary, and no receiver is going to raise it. You have to work within it.

How to tell if you're over

Our SPF checker counts lookups and flags the culprits. The usual suspects are domains running several senders at once (Google Workspace plus Mailchimp plus SendGrid plus a helpdesk), each one chaining into nested includes you didn't know existed.

How to fix it

A few options, in the order you should like them:

  • Remove senders you don't actually use. The easiest win. Audit every include and delete the ones from services you stopped using 2 years ago (it happens to everyone).
  • Consolidate senders. If you're running 4 ESPs, ask whether you really need 4. Each one eats lookups.
  • Replace "include" with specific IP ranges. Instead of including a third party's whole record, list the specific ip4: or ip6: ranges they give you. This trades maintenance for headroom.
  • SPF flattening as a last resort. Some tools rewrite your record with only IPs, eliminating lookups. It works, but you have to refresh it when the upstream provider's IPs change. Set a reminder. Otherwise mail will silently break.

So if If your record is blowing past 10 lookups and you're not sure which includes to cut, the SOS hotline is free and we've seen every variation of this mess.

Contributors

Who worked on this answer

Every name links to their profile. Every company links to their site. Real people, real accountability.

Ask an AI · tailored to your setup

Audit My SPF Record

I just read the Email Almanac entry on SPF DNS lookup limits. Help me audit my SPF record and bring it safely back under 10 lookups. Walk me through: 1. Which includes are eating the most lookups 2. Which senders I can safely remove 3. Whether I should consolidate ESPs, switch to IP ranges, or flatten 4. What to watch for after any change so I don't break legitimate mail --- My details (fill in what applies): - Sending domain: your domain - Current SPF lookup count (if known): number or unsure - Active sending sources I know about: list the ESPs, CRMs, helpdesks, etc. - Services I think I stopped using: list any I'm unsure about - How I manage DNS: [self-hosted, provider like Cloudflare, hosted by IT team, unsure] - Am I open to SPF flattening if needed? yes / no / not sure

Edit the yellow boxes, then send to the AI of your choice.