# SPF too many DNS lookups: the 10-lookup limit and how to fix it

Why SPF breaks after 10 DNS lookups, how to count yours, and how to get back under the limit without cutting off a service that sends your email.

Canonical URL: https://dmarcdone.com/blog/spf-too-many-dns-lookups | Published: 2026-10-05

SPF allows at most 10 DNS lookups per check, and lookups inside nested includes count too. If a checker says your record needs "too many DNS lookups", receivers get a permanent error (`permerror`) instead of a pass, so your SPF record is broken for some receivers right now, even though it looks fine. The usual fix is to remove services you no longer use.

## What SPF does, in one paragraph

SPF (Sender Policy Framework) is a TXT record at the root of your domain that lists which servers may send email for it. It starts with `v=spf1` and ends with an `all` rule. A receiving server reads it, works out whether the sending server is on the list, and passes or fails the message. SPF is defined in RFC 7208.

A typical record for a business on [Microsoft 365](https://dmarcdone.com/guides/microsoft-365) that also sends from Salesforce and Mailgun looks like this:

```text
v=spf1 include:spf.protection.outlook.com include:_spf.salesforce.com include:mailgun.org -all
```

Each `include:` says "also accept whatever servers this other domain lists". That is convenient, and it is also where the trouble starts.

## The 10-lookup limit

To find out which servers are allowed, the receiver has to look things up in DNS. Every `include:` means at least one more DNS query, and the included record can contain its own includes.

To stop this from turning into an endless chain, RFC 7208 (section 4.6.4) caps it. The terms that cause DNS queries are the `include`, `a`, `mx`, `ptr` and `exists` mechanisms and the `redirect` modifier. Receivers must limit the total number of those terms to 10 during one SPF check. If the limit is exceeded, the result is `permerror`, a permanent error.

The same section sets a second, smaller limit: receivers should allow no more than two "void lookups", meaning lookups that return no answer. An `include:` pointing at a domain that no longer publishes SPF counts as one of those.

## What permerror does to your email

A `permerror` is not a pass. What happens next depends on the receiver:

- Some reject the message outright. Microsoft describes bounce messages with errors such as "The message required too many lookups."
- Others treat it like an SPF failure and lean on DKIM instead.

For DMARC (Domain-based Message Authentication, Reporting and Conformance, the policy layer on top of SPF and DKIM), an SPF `permerror` means SPF cannot help that message pass. If the message also has a valid DKIM signature that matches your domain, DMARC can still pass on DKIM alone. If it does not, the message fails DMARC. Once you move to `p=quarantine` or `p=reject`, that failed message goes to spam or bounces.

Microsoft also points out that receivers evaluate the record from left to right and stop at the first match. So a record with too many lookups can work for mail that matches an early entry and fail only for mail that matches a late one. That is why the problem often shows up as "some of our invoices bounce" rather than "all email is broken".

## How to count your lookups

Count one for each of these in your record: `include:`, `a`, `mx`, `ptr`, `exists:` and `redirect=`. These are free and never count: `ip4:`, `ip6:` and `all`.

Then open every `include:` and count what is inside it, because nested terms add up. Microsoft gives the arithmetic: an `include:` that points to a record containing three more includes costs four lookups in total, one for the first lookup and three for the nested ones.

A worked example with real services, counted on 6 October 2026:

```text
v=spf1 mx include:spf.protection.outlook.com include:_spf.salesforce.com include:mailgun.org -all
```

- `mx`: 1
- `include:spf.protection.outlook.com`: 1. Its record lists only IP ranges, so nothing more.
- `include:_spf.salesforce.com`: 1, and its record holds one `exists` term: +1
- `include:mailgun.org`: 1, and its record includes Mailgun's US and EU lists, with the US list split into two more includes: +4
- `-all`: 0

Total: 9 of the 10 allowed. One more include that costs a single lookup still fits. Anything bigger, such as SendGrid's at 2, breaks the record.

### What common includes cost

These are the domains common services ask you to `include:`, with the lookups each one costs: the `include` itself plus everything nested inside it. We measured them with `dig` against Cloudflare's public resolver (1.1.1.1) on 6 October 2026, counted the way RFC 7208 does, and got the same numbers from Google's resolver (8.8.8.8). Vendors change these records, so recount before you rely on them.

| Service | Include domain | Lookups | Where the vendor's setup puts it |
|---|---|---|---|
| Google Workspace | `_spf.google.com` | 1 | Your root SPF record |
| Microsoft 365 | `spf.protection.outlook.com` | 1 | Your root SPF record |
| Mailchimp | `servers.mcsv.net` | 1 | Not asked for: Mailchimp's setup uses DKIM and DMARC records |
| Brevo | `spf.brevo.com` | 1 | Only with a dedicated IP |
| Amazon SES | `amazonses.com` | 1 | Only on a custom MAIL FROM subdomain |
| SendGrid | `sendgrid.net` | 2 | Not by default: SendGrid's automated security covers SPF with a CNAME |
| Salesforce | `_spf.salesforce.com` | 2 | Your root SPF record |
| Zoho Mail | `zohomail.com` (EU: `zohomail.eu`) | 2 | Your root SPF record |
| Microsoft 365 from GoDaddy | `secureserver.net` | 3 | Your root SPF record |
| Mailgun | `mailgun.org` | 5 | Your root, or a sending subdomain such as `mail.example.com`, which Mailgun recommends |

The Mailchimp value comes from Google's SPF setup page, which lists it among its examples. Every other value is on the vendor's own setup page, linked in the sources.

The big numbers come from nesting. Mailgun's include pulls in separate US and EU lists, and GoDaddy's already contains Microsoft's `spf.protection.outlook.com`, so adding both counts Microsoft twice. Four of these ten services do not ask for an include in your root record in their default setup, which is fix 3 below.

Counting by hand gets tedious fast, and vendors change their records without telling you. The [free SPF and DMARC checker](https://dmarcdone.com/#check) follows every include, counts lookups and void lookups the way RFC 7208 does, and shows the total.

## How to fix it, safest first

### 1. Remove services you no longer use

This is the fix that works most often. SPF records grow over the years. An old newsletter tool, a previous email host or a website plugin from a redesign two years ago stays in the record because nobody remembers why it was added.

Before you delete anything, find out what really sends mail as you. DMARC aggregate reports are the best evidence: they list every server that sent mail using your domain, with message counts. If a service has not appeared in a month of reports, its include is a strong candidate for removal. If you have no DMARC record yet, start with our post on [publishing your first DMARC record](https://dmarcdone.com/blog/no-dmarc-record-found).

### 2. Remove terms that do nothing

- **`ptr`**: RFC 7208 says this mechanism "SHOULD NOT be published". It is slow and unreliable. Remove it.
- **`a` and `mx`**: these authorize your website's server and your incoming mail servers. If your website does not send mail and your inbound mail is handled by Microsoft 365 or [Google Workspace](https://dmarcdone.com/guides/google-workspace), they may add lookups for nothing. Check before removing, because some website contact forms do send through the web server.
- **Duplicates**: the same include written twice still costs twice.

### 3. Ask each vendor whether they need your SPF at all

SPF checks the envelope sender (the hidden bounce address, also called MAIL FROM), not the From address your customers see. Some email services send with their own bounce address, or with a subdomain of yours that you point at them, and rely on DKIM for DMARC. If a vendor works that way, its include in your root record costs you lookups and does nothing. Their setup documentation usually says which records they need. In [the table above](https://dmarcdone.com/blog/spf-too-many-dns-lookups#what-common-includes-cost), Mailchimp, Brevo, Amazon SES and SendGrid are examples: by default, none of them asks for an include in your root record.

### 4. Move bulk senders to a subdomain

Microsoft recommends sending marketing or bulk email from a subdomain such as `news.example.com`. Each subdomain has its own SPF record and its own 10-lookup budget. It also keeps a marketing tool's reputation problems away from your main domain.

### 5. Flattening, with care

"Flattening" means replacing an `include:` with the IP addresses it currently resolves to, written as `ip4:` and `ip6:` entries. IP entries cost no lookups, so the count drops.

The trade-off is maintenance. The vendor can change its sending IP addresses at any time. Your flattened record will not notice, and mail from the new addresses will start failing SPF with no warning. Microsoft's guidance is specific:

- Flattening can suit vendors with stable, documented IP ranges.
- Do not flatten Microsoft 365's `include:spf.protection.outlook.com`, because its sending addresses change frequently.
- If you flatten, record what you replaced, watch vendor announcements and review the entries at least quarterly.

Automated flattening services update the IPs for you. That solves the staleness problem but makes your SPF depend on another company's uptime. For most small businesses, steps 1 to 4 get the count under 10 without any of this.

## Two other SPF errors that look similar

- **Two SPF records.** Only one TXT record starting with `v=spf1` is allowed per domain. Two records produce `permerror` as well. Merge them into one.
- **Syntax slips.** Microsoft lists common ones: a trailing dot after the domain, `include=` instead of `include:`, or a space after the colon.

## After the fix

Run the [SPF lookup check](https://dmarcdone.com/#check) again and confirm the lookup count is 10 or less and the void lookup count is 2 or less. Then keep an eye on DMARC reports for a week: if a legitimate service starts failing SPF, you removed something it needed.

A clean SPF record is also a prerequisite for moving DMARC to enforcement. If you want someone else to untangle your senders and take the domain all the way to `p=reject`, our [DMARC enforcement service](https://dmarcdone.com/pricing) does exactly that.

## Sources

- RFC 7208, Sender Policy Framework (SPF), section 4.6.4 (DNS lookup limits) and section 5.5 (ptr): https://datatracker.ietf.org/doc/html/rfc7208#section-4.6.4
- Microsoft Learn, Set up SPF to identify valid email sources for your Microsoft 365 domain: https://learn.microsoft.com/en-us/defender-office-365/email-authentication-spf-configure
- RFC 7208, section 4.5 (multiple records): https://datatracker.ietf.org/doc/html/rfc7208#section-4.5
- RFC 9989, DMARC: https://www.rfc-editor.org/rfc/rfc9989.html
- Lookup counts: our own DNS queries on 6 October 2026, one per record in each include chain, for example `dig +short TXT mailgun.org @1.1.1.1`, repeated against 8.8.8.8 with the same totals
- Google Workspace Admin Help, Set up SPF (Google, Microsoft, Mailchimp, Amazon, GoDaddy and Salesforce includes): https://knowledge.workspace.google.com/admin/security/set-up-spf
- Mailchimp, Set up email domain authentication: https://mailchimp.com/help/set-up-email-domain-authentication/
- Brevo Help, Authenticate your domain with Brevo: https://help.brevo.com/hc/en-us/articles/12163873383186-Authenticate-your-domain-with-Brevo-Brevo-code-DKIM-DMARC
- Brevo Help, Merge multiple SPF records: https://help.brevo.com/hc/en-us/articles/4414335084434-Merge-multiple-SPF-records
- Amazon SES Developer Guide, Using a custom MAIL FROM domain: https://docs.aws.amazon.com/ses/latest/dg/mail-from.html
- Twilio SendGrid Docs, Configure domain authentication: https://www.twilio.com/docs/sendgrid/ui/account-and-settings/how-to-set-up-domain-authentication
- Twilio SendGrid Docs, Verify sending email servers with SPF: https://www.twilio.com/docs/sendgrid/ui/sending-email/verify-sender-with-spf
- Salesforce Help, Include Salesforce in your SPF record: https://help.salesforce.com/s/articleView?id=xcloud.emailadmin_spf_include_salesforce.htm&type=5
- Zoho Mail Help, SPF configuration: https://www.zoho.com/mail/help/adminconsole/spf-configuration.html
- GoDaddy Help, Add an SPF record to my domain for my email: https://www.godaddy.com/help/add-an-spf-record-to-my-domain-for-my-email-40499
- Mailgun Help, Domain verification setup guide: https://help.mailgun.com/hc/en-us/articles/32884700912923-Domain-Verification-Setup-Guide
