SPF Checker
Validate a domain's SPF record, expand every include, and count DNS lookups against the limit of 10 set by RFC 7208.
What this tool checks
SPF (Sender Policy Framework, RFC 7208) lets a domain publish, in a TXT record, the list of servers allowed to send email using that domain in the envelope sender address. A receiving server compares the IP address of the connecting server with the list and gets a result such as pass or fail.
The checker looks up the SPF record of the domain you enter and:
- confirms there is exactly one record starting with
v=spf1; - parses every mechanism and modifier;
- follows every
includeandredirectrecursively, as a receiver would; - counts the DNS lookups needed and the void lookups (lookups that return nothing);
- reports syntax errors and risky settings.
How to read the result
The record and its mechanisms
Each term of the record is listed with its qualifier, which sets the result when the term matches:
| Qualifier | Result | Meaning |
|---|---|---|
+ (default) |
pass | The server is authorised. |
- |
fail | The server is not authorised. |
~ |
softfail | Probably not authorised; accept but treat with suspicion. |
? |
neutral | No statement. |
The mechanisms are:
| Mechanism | Matches when | DNS lookup |
|---|---|---|
ip4:192.0.2.0/24, ip6:2001:db8::/32 |
The sender’s IP is in the range | no |
a, a:host.example.com |
The sender’s IP is an A/AAAA address of the domain or host | yes |
mx |
The sender’s IP is an address of one of the domain’s MX hosts | yes |
include:_spf.example.net |
The included domain’s SPF returns pass | yes |
exists:... |
A constructed name has an A record (used with macros) | yes |
ptr |
Reverse DNS of the sender matches; discouraged by RFC 7208 | yes |
all |
Always; it belongs at the end | no |
The redirect= modifier replaces the whole evaluation with another domain’s record when nothing else matched; it also costs a lookup.
Lookup count
The number shown is the total for the whole evaluation, including every nested include. The limit is 10. If evaluation would need more, receivers stop and return permerror, which most treat as an SPF failure, and DMARC then relies on DKIM alone. Separately, more than 2 void lookups also causes permerror.
A typical record
v=spf1 mx ip4:198.51.100.25 include:_spf.example.net -all
This authorises the domain’s MX servers, the address 198.51.100.25 and whatever _spf.example.net authorises, and fails everything else. It costs 2 lookups plus those inside _spf.example.net.
Common problems and fixes
- Two SPF records. Merge them.
v=spf1 include:a.example.net -allandv=spf1 include:b.example.net -allbecomev=spf1 include:a.example.net include:b.example.net -all. - Too many lookups. Every email platform, CRM and helpdesk adds an include, and each include may contain more. Remove services you no longer use. Where a provider publishes stable IP ranges,
ip4andip6cost nothing. Some senders can move to a subdomain with its own SPF record. Be careful with “SPF flattening” services that replace includes with IPs: if the provider changes its addresses, your record goes stale. +allor?all. These authorise every server, or say nothing, which makes SPF useless. End with-allor~all.- Includes pointing to domains that do not exist. Typos and retired services cause void lookups. Remove them.
- Using
ptr. It is slow and unreliable, and RFC 7208 says not to use it. Replace it withip4,ip6ora. - Mechanisms after
all. They are never evaluated. Putalllast. - SPF passes but DMARC fails. DMARC requires alignment: the domain that passed SPF (the envelope sender) must match the visible From domain. Many platforms send with their own envelope domain, so SPF passes for them, not for you. Use DKIM signing with your own domain, or configure a custom return-path. See the DMARC checker.
Related
- Email checker: SPF together with MX, DKIM, DMARC, MTA-STS, TLS-RPT and BIMI.
- TXT record guide: how TXT records and their 255-byte strings work.
- MX record guide: what the
mxmechanism refers to. - TXT lookup: see the raw record as published.
Frequently asked questions
Should I end my SPF record with -all or ~all?
-all (fail) states clearly that no other server may send for the domain, and is the right choice once you are sure the record lists every legitimate sender. ~all (softfail) is a common, more cautious choice during setup. In practice, with DMARC in place, the DMARC policy decides what happens to failing mail; never use +all, which authorises the whole internet.
What counts towards the 10-lookup limit?
The mechanisms include, a, mx, ptr and exists, and the redirect modifier, including those inside every included record. ip4, ip6 and all do not count, because they need no DNS query.
What is a void lookup?
A lookup that returns no records, either NXDOMAIN or an empty answer. RFC 7208 recommends limiting them to 2 per evaluation, because they usually mean the record refers to something that no longer exists.
Do I need SPF on subdomains?
SPF is checked on the exact domain used in the envelope sender (MAIL FROM) or, if that is empty, the HELO name. A subdomain that sends mail needs its own record. A subdomain that never sends mail can publish v=spf1 -all to prevent misuse.