SPF PermError: too many DNS lookups

SPF allows 10 DNS lookups and your record needs more. How to count them and get back under the limit without flattening.

You see this in a report, a header or a checker:

spf=permerror (too many DNS lookups)
Received-SPF: PermError ... SPF Permanent Error: Too many DNS lookups

SPF limits the number of DNS lookups a receiver does while evaluating your record to 10 (RFC 7208, section 4.6.4). If your record needs more, the result is permerror and receivers treat SPF as failed, for every message, from every service.

What counts

Counts as a lookupFree
include:, a, mx, exists:, redirect=, ptrip4:, ip6:, all

Nested lookups count too. include:_spf.google.com costs 1 for the include, plus the includes inside Google's record. Some providers' records cost 3 or 4 lookups on their own. That's how a record with five includes quietly ends up at 12.

How to get under 10

  1. Remove services you no longer use. Old newsletter tools and previous mail providers are common leftovers.
  2. Remove includes that aren't needed. If a platform sends with its own bounce domain (check the Return-Path of a message it sent), your SPF record is never checked for its mail. Its include does nothing; DKIM is what makes its mail pass DMARC.
  3. Replace a and mx with ip4:/ip6: when they only cover a few fixed addresses of your own.
  4. Move services to a subdomain. Let your marketing platform use news.example.com as its bounce domain, with its own SPF record. Each subdomain gets its own budget of 10.
  5. Flatten only as a last resort. Replacing includes with the IP addresses they currently contain works until the provider changes its addresses, and then mail breaks without warning. If you flatten, you have to re-check it regularly.

Stay at 8 or 9 rather than exactly 10, so the next tool someone connects doesn't push you over. There's also a separate limit of two void lookups.