SPF lookup counter

Short answer

How do I count SPF lookups?

SPF allows at most 10 DNS lookups per check, and every include, a, mx, ptr, exists and redirect counts as one, also inside the records you include. ip4, ip6 and all do not count. Enter the domain in the lookup counter and we walk through the whole tree and show the total and which service uses the most lookups.

Enter the domain and we count every lookup in every include.

What counts

include, a, mx, ptr, exists and redirect cost one lookup each, also inside the records you include. ip4, ip6 and all cost nothing.

Example of counting

The record v=spf1 mx include:spf.protection.outlook.com include:_spf.google.com -all uses at least three lookups: one for mx and one for each include. If the included records have their own includes, those come on top.

mx costs one lookup. The addresses of the mail servers are looked up as well, but they do not count against the limit. Instead RFC 7208 sets a limit of 10 mail servers per mx.

How to read the result

  • Green: below 9 lookups, a good margin.
  • Yellow: 9 or 10. One more service can take you over.
  • Red: over 10. SPF gives permerror for all email from the domain.
  • Void lookups above 2 also give permerror.

How to get below the limit

  • Remove services you no longer use.
  • Replace a and mx with ip4 when your own servers have fixed addresses.
  • Send newsletters from a subdomain, like news.company.com, with its own SPF record.
  • Use flattening only as a last resort, because it needs upkeep.

Questions and answers

What happens above 10?

SPF gives permerror, and receivers treat it as if SPF fails for all email.

Does redirect count as a lookup?

Yes. redirect costs one lookup, and all the lookups in the record it points to count too.

Why do other tools show a different number?

Some count only the direct lookups, and some count the addresses behind mx wrongly. Services also change their records, so the number can change from day to day.