spf record generator
build a valid SPF record from your senders. add your includes (Google, Microsoft, SendGrid…), any static IPs and a qualifier, and copy the TXT record — with a live count against the 10-DNS-lookup limit that silently breaks SPF.
v=spf1 mx include:_spf.google.com -all
2 of 10 DNS lookups used (a, mx and each include count; ip4/ip6 are free).
Overview
SPF (Sender Policy Framework) is a single TXT record at your domain's apex that lists which servers are allowed to send mail as your domain. it starts with v=spf1 and is a sequence of mechanisms — a (your A records), mx (your MX hosts), ip4:/ip6: (literal addresses), include: (another domain's SPF, used for Google/Microsoft/ESPs) — ending in an 'all' qualifier that says what to do with everything else. two things break SPF in practice. first, the qualifier: -all (hardfail) rejects unlisted senders, ~all (softfail) accepts-but-marks them, ?all (neutral) does nothing, and +all authorizes the whole internet — never use +all. second, the 10-DNS-lookup limit: a, mx and every include each cost one DNS lookup, and if the total exceeds 10 the record returns PermError and SPF fails entirely. this generator counts those lookups as you build so you don't blow the limit.
How to use
- add your senders — tick a/mx if you send from your own servers; add an include: for each ESP.
- add any static IPs — ip4:/ip6: for fixed sending addresses — these don't count toward the lookup limit.
- pick a qualifier — -all is recommended once you're sure every sender is listed; ~all while testing.
- publish one TXT record — at the apex (yourdomain.com). a domain must have exactly one SPF record.
Examples
input
include _spf.google.com · -alloutput
v=spf1 include:_spf.google.com -allinput
mx + Google + SendGrid · ~alloutput
v=spf1 mx include:_spf.google.com include:sendgrid.net ~allCommon mistakes
only one SPF record per domain— two v=spf1 TXT records is a PermError and breaks SPF. merge every sender into a single record.the 10-lookup limit— a, mx and each include cost a lookup; over 10 total, SPF PermErrors. ip4/ip6 are free — prefer them, or flatten includes.never use +all— +all lets anyone send as your domain, which defeats the entire point of SPF.SPF alone doesn't stop spoofing— SPF checks the envelope sender, not the visible From:. you need DKIM and DMARC to actually stop From-header spoofing.
FAQ
can i have more than one SPF record?
no. exactly one v=spf1 TXT record per domain — multiple records are a PermError. combine all senders into one.
which qualifier should i use?
-all (hardfail) for a locked-down domain once every sender is listed; ~all (softfail) while you're still confirming senders.
what is the 10-lookup limit?
SPF permits at most 10 DNS-querying mechanisms (a, mx, include, and a few others). exceeding it returns PermError and SPF fails.
do i still need SPF if i have DMARC?
yes — DMARC passes when SPF or DKIM aligns, so SPF is one of the two things DMARC checks.
what is SPF flattening?
flattening replaces include: mechanisms with the literal ip4:/ip6: addresses they resolve to, so you stay under the 10-lookup limit. the cost is you must re-flatten whenever a provider changes their sending IPs.
Related tools
spf checker— find and parse a domain's SPF (sender policy framework) record.dmarc record generator— build a valid DMARC TXT record from your policy, reporting addresses and alignment — with warnings for the mistakes people make.dmarc checker— find and parse a domain's DMARC policy record at _dmarc.<domain>.mx lookup— list the mail exchangers (MX records) a domain advertises, sorted by priority.
References
Free beta
Unlock your full scan (free beta)
Add one DNS TXT record to prove you own the domain, then we run a deeper active scan — exposed secrets and config — and send you a private report. Free beta, no payment.
- Finds exposed .env / .git / backups and other sensitive files
- Verified by a DNS TXT record, so only you can run it on your domain
- A private report emailed straight to you