How to fix an SPF record with too many lookups

If a mail service says your SPF record has too many DNS lookups, your list of approved senders has grown too long to check, and your email fails SPF. Here is why, and how to bring it back under the limit.

What the limit is

Your SPF record lists the services allowed to send email for your domain. To check it, a mail service looks up each service you name, and each of those can name others. Every one of those lookups counts.

The SPF standard allows 10 per check, so that checking one email can't make a mail service do unlimited work. Past 10, the mail service stops and treats the check as failed, even for email you really sent.

What counts as a lookup

  • Each include: entry, such as include:_spf.google.com, plus every lookup inside the record it points to
  • The a and mx entries, which look up your own website and mail servers
  • Any exists: entry, and a redirect= at the end of the record

Entries that start with ip4: or ip6:, and the ~all at the end, cost nothing. They are written out in full, so nothing has to be looked up.

Why it happens

Nobody writes a record with 11 lookups on purpose. It grows one service at a time. First your email provider, then a newsletter tool, a help desk and an invoicing app. Each one's setup page says to add its include: entry, and none of them can see the others.

Some services use several lookups on their own, because the record they ask you to name points to further records of theirs. A record that was fine last year can go over the limit when one of them adds another.

How to see which entries use the most

The free check counts every lookup your record takes, including the ones inside each service it names. Over 10, it lists the entries that cost the most, so you know where to start. Under 10, it shows how many of the 10 you use.

Check your own SPF record

Four ways to get back under 10

  • Remove services you no longer use. Records often still name a provider the business left years ago. This is the quickest fix
  • Remove the a and mx entries, unless your own website or mail server sends email itself. Most small businesses send through a provider, so those entries only spend lookups
  • Send newsletters and marketing email from a subdomain such as news.yourbusiness.com. It gets its own SPF record with its own 10 lookups, and your everyday email keeps the rest
  • Ask each service whether it signs your email with DKIM under your own domain. An email passes DMARC when either SPF or DKIM passes for your domain, so a service that signs as you may not need a place in your SPF record. Follow that service's own setup page before removing it

Make the change where your domain's DNS is managed, then run the check again. New settings can take up to an hour to show.

A word on flattening

Some tools offer to flatten your record. They replace each include: entry with the server addresses behind it today, which brings the count close to zero. The catch is that services change their addresses, and large providers do it without notice. When that happens, your record is out of date and your email starts failing again, with nothing to warn you. Removing entries you don't need is the fix that lasts. If you do flatten, use a service that keeps the record up to date for you.

Check your own domain

Free, a few seconds, and no sign-⁠up.

Questions people ask

What does SPF permerror mean?

It means a mail service found your SPF record but couldn't use it. Going over 10 lookups is the most common cause; two SPF records on one domain, or a typing mistake in the record, are the others. Mail services count it as a failed check.

Do the lookups inside each include: entry count?

Yes. Counting only the entries you can see in your own record is the most common mistake. One include: entry can cost four lookups or more once the records behind it are counted.

Will going over the limit send all my email to spam?

Not always, but it makes it much more likely. Every email fails SPF, so it rests on DKIM alone. If DKIM is missing too, or signs only in your provider's name, your DMARC rule counts the email as failed.

Sources