SPF record syntax explained, with examples
An SPF record is one TXT record on your domain listing who may send mail using it.
v=spf1 include:_spf.google.com include:sendgrid.net ip4:203.0.113.5 ~all
| Part | Meaning |
|---|---|
v=spf1 | Required first token. |
include: | Also allow whatever another domain’s SPF allows (your mail provider). |
ip4: / ip6: | Allow a specific address or range. |
a / mx | Allow the domain’s A or MX hosts. |
~all | Softfail everything else (accept but mark). |
-all | Fail everything else. |
?all / +all | Neutral / allow everyone. Avoid both, +all especially. |
Examples
Google Workspace only: v=spf1 include:_spf.google.com ~all
Domain that never sends mail: v=spf1 -all
~all or -all?
With DMARC in place, receivers mostly act on the DMARC policy, so the difference matters less than people think. ~all is the common safe default; -all is fine once you’re sure every sender is listed.
See exactly what your domain’s SPF, DKIM and DMARC look like, free.
Check my domain