Knowledge base
SPF record syntax
Mechanisms, qualifiers and modifiers, with examples and the limits that trip people up.
An SPF record is a single TXT record on the domain used in the envelope sender. It starts with v=spf1 and is followed by terms that are evaluated left to right; the first match decides the result.
Mechanisms
| Mechanism | Matches | DNS lookup |
|---|---|---|
ip4:203.0.113.0/24 | An IPv4 address or range | No |
ip6:2001:db8::/32 | An IPv6 address or range | No |
a, a:host.example.com | The A/AAAA addresses of the domain or host | Yes |
mx, mx:example.com | The domain's mail servers | Yes |
include:_spf.example.net | Anything the other domain's SPF record allows | Yes, plus its own |
exists:%{i}.example.com | If a constructed name resolves (advanced) | Yes |
ptr | Reverse DNS. Deprecated; do not use. | Yes |
all | Everything. Always last. | No |
Qualifiers
Each mechanism can have a prefix: + pass (the default), - fail, ~ softfail, ? neutral. In practice only the all at the end has a prefix: -all or ~all.
Modifiers
redirect=example.netuses another domain's record instead. Ignored if the record has anall.exp=points to an explanation string. Rarely used.
Limits
- 10 DNS lookups across the whole evaluation, including nested includes. More is a permanent error.
- 2 void lookups (names that do not exist or have no records). More is a permanent error.
- One record. Two
v=spf1records is a permanent error. - 255 characters per string. Longer records are split into several quoted strings in one TXT record; DNS hosts usually do this for you.
Check yours with the SPF surveyor.
See it on your own domain.
Check your DMARC, SPF and DKIM setup in seconds, then let us watch your reports for you.
Start free