SPF record check

Checks SPF syntax, follows the whole include chain and counts DNS lookups against the RFC 7208 limit.

The ten DNS lookup limit

RFC 7208 section 4.6.4 allows no more than ten DNS lookups while an SPF record is evaluated. The mechanisms include, a, mx, ptr and exists each cost one lookup, and so does the redirect modifier. Lookups made inside an include count towards the same total, which is why a record with four includes can be far over the limit while looking short.

The same section limits void lookups, the ones that return an empty answer or a name that does not exist, to two. Crossing either limit gives permerror, and a large share of receivers treat permerror the same way as a failed check. This tool follows the whole chain and shows the running count.

What to do when there are too many lookups

  • Remove services you no longer use. An old include survives for years after the service behind it is gone.
  • Replace some includes with the actual ip4 and ip6 ranges. Those cost no lookups, but you have to watch for changes on the provider side.
  • Do not use ptr. It is slow, unreliable and discouraged for SPF.
  • Keep one record per domain and end it with -all or ~all, not ?all.

Frequently asked questions

What is the difference between -all and ~all?

With -all you state that no other server is authorised and the message may be rejected. With ~all the result is softer: the message most likely lands in the spam folder. Start with ~all and move to -all once you are sure the list of senders is complete.

Can a domain have two SPF records?

No. Two v=spf1 records give permerror and the check fails as a whole, even when each record is correct on its own. Every source has to be merged into one record.

What counts as a void lookup?

A lookup that comes back empty or with a name that does not exist, typically an include of a service that was shut down, or a typo in a host name. More than two of them end the evaluation with permerror, the same as running past ten lookups.

Is SPF enough to keep mail out of the spam folder?

No. SPF only checks the sending server, and it stops matching as soon as a message is forwarded. It works together with DKIM, which survives forwarding, and DMARC, which ties both results to the address the recipient actually sees.