SPF caps the number of DNS queries a receiver will make while evaluating your record at 10 (RFC 7208 §4.6.4). Go over and the result is permerror: SPF fails for every message, legitimate or not, and DMARC has to rely on DKIM alone.
What counts
These terms each cost one lookup: include, a, mx, ptr, exists, and the redirect modifier. ip4, ip6 and all are free.
The count is for the whole tree. include:_spf.google.com costs one lookup itself, and the record it points at contains further includes that are counted too. A record that looks like it has four terms can easily cost twelve.
There is a second limit people meet less often: no more than 2 void lookups, meaning queries that return nothing. An include for a service you cancelled, whose SPF record is gone, counts against it.
How to get back under the limit
- Remove what you no longer use. Old marketing tools and abandoned trials are the usual culprits. This is the only fix with no downside.
- Replace
aandmxwith addresses. If your web server sends mail from a fixed IP,ip4:203.0.113.10does the same job asafor free. - Move senders to a subdomain. Marketing mail sent from
news.example.comis checked against that subdomain's own SPF record, with its own budget of 10. Most bulk-mail tools support a custom sending domain. - Flatten, carefully. Replacing an include with the IP ranges it resolves to removes lookups, but the provider can change those ranges at any time without telling you. Only flatten with a tool that keeps the record updated automatically.
Checking the count
The SPF checker walks every include and redirect, counts the lookups and void lookups across the tree, and shows how much each include costs, so you can see which ones to cut.
