SPF Explained: What It Is, How SPF Records Work & How to Check Yours
Published November 2026 — Current as of November 2026 — Estimated read time: 10 minutes
Email is one of the few technologies where anyone can write any sender address on an envelope. When a message arrives claiming to be from your domain, the receiving server has to decide whether the sending computer is actually yours — or a forger borrowing your name. That decision is exactly what an SPF record exists to make. This guide explains what an SPF record is, how SPF syntax and mechanisms work, the difference between -all and ~all, and how to do an SPF record check on your own domain — free.
If you only want the answer for one domain, run it through the free SPF Checker — it fetches the record, tests it against a live DNS evaluation, and flags the common problems below. The rest of this article is the how-it-works manual behind that result.
Email Spoofing Is Why SPF Exists
The Simple Mail Transfer Protocol (SMTP) was designed in an era when nearly every mail server was trusted. It has no built-in way to prove that the From address on an email is the address that actually sent it. Anyone can connect to a mail server and stamp your company's domain onto a message — no credentials required. That is email spoofing, and it is the engine behind phishing and business email compromise (BEC) attacks.
When a domain has no SPF record, the receiving server has nothing to compare against. A forged message from "yourdomain.com" looks identical to a legitimate one at the protocol level, so the receiver must guess. Some filters will flag the message, many will not, and a few will even treat it as a trusted internal sender. Publishing an SPF record does not make spoofing impossible, but it gives receivers a concrete list of authorized senders, which is the foundation of email spoofing protection.
What Is an SPF Record?
An SPF record is published as a DNS TXT record at the domain's apex (RFC 7208). It is a single string that authorizes which mail servers may send mail for that domain. If your domain is example.com, the SPF record lives at example.com — not at www.example.com, and not in a subdomain. The version tag v=spf1 MUST appear first and the whole record is one string.
It is equally important to understand what an SPF record is not:
- Not a filter. It does not read message content, subject lines, or attachments.
- Not a spam score. An SPF pass or fail is one data point a receiver may consider; it is not a spam verdict.
- Not encryption or signing. SPF does NOT verify message content or encrypt anything; a passing SPF check only means the sending IP was authorized by the domain owner. Cryptographically signing message bodies is DKIM's job.
How SPF Works, Step by Step
When a receiving mail server accepts a message, it extracts the domain from the MAIL FROM (envelope) command, looks up that domain's TXT records, and finds the SPF string. It then walks the mechanisms left to right until the sending IP address matches one of them, and applies that mechanism's qualifier to produce a result: pass, fail, softfail, or neutral.
- The incoming connection's source IP is compared against each mechanism in order.
- The first mechanism that matches wins — evaluation stops there. Mechanisms after the match are never evaluated.
- The qualifier on the matching mechanism sets the outcome the record declares to the receiver.
- If nothing matches, the final
allmechanism — which always matches — determines the fallback result.
SPF Syntax & Mechanisms
SPF records read like a small policy language. Mechanisms are evaluated left to right, first match wins: all, ip4:<addr[/len]>, ip6:<addr[/len]>, a, mx, include:<domain>, exists:<domain>. The ptr mechanism is DEPRECATED by RFC 7208 and should not be used.
Each mechanism can be prefixed with a qualifier: + (pass), - (fail / hardfail), ~ (softfail), ? (neutral). The default qualifier is +, so mx means +mx.
- IP ranges.
ip4:prefixes may be shorter than /32 (e.g.ip4:203.0.113.0/24); CIDR notation applies. - include: pulls in the SPF record of another domain (e.g.
include:_spf.google.com); it must NOT be used to express the sender's own domain logic. - Modifiers.
redirect=is a modifier (not a mechanism) that replaces the current domain's record evaluation with the target domain's;exp=is the other modifier (explanation string on hardfail). - The 10-lookup limit. SPF records are limited to 10 DNS lookups per evaluation (RFC 7208 §4.6.4) — each
include:, and each distincta/mxmechanism without a matching cached result, counts toward the limit. Records that exceed it are treated aspermerrorby compliant receivers.
SPF -all vs ~all: Hardfail vs Softfail
The last mechanism in a record is almost always all, which catches every IP that did not match anything earlier. Its qualifier decides what receivers are told about those unmatched senders.
- ~all (softfail). "Probably not authorized." The receiver can treat the message as suspicious without hard-rejecting it. This is a common safe default while you are still discovering all your legitimate sending services, because it is much less likely to break mail delivery.
- -all (hardfail). "Definitely not authorized." The receiving server is told the message fails SPF and may reject it outright. This is stricter and more protective, and it is what you move to once you are confident every legitimate sender is listed.
Here are three concrete records. A Google Workspace style record for a domain that sends through Gmail:
v=spf1 include:_spf.google.com ~allA basic in-house record for a domain whose own mail server and IPs do the sending:
v=spf1 ip4:203.0.113.10 mx ~allAnd the "publish nothing" record for a domain that sends no mail at all. v=spf1 -all means "no host is authorized" — the correct record for a domain that sends no mail. Note that a no-mail domain can safely use -all from day one, because there is no legitimate sender to protect.
How to Check Your SPF Record
The fastest way is the check SPF tool: type your domain, and it returns your current record, whether it parses, how many DNS lookups it uses, and whether it ends in -all, ~all, or nothing. Run an SPF record check on every domain you own — including ones you think send no mail.
If you prefer the command line, use dig and filter for TXT records:
dig TXT example.com +short | grep "v=spf1"The output should be a single quoted string starting with v=spf1. If you see multiple SPF strings, several longer than the allowed character limit, or no result at all, you have found the problem this guide is about.
Common SPF Mistakes
- Hitting the 10-lookup limit. Every
include:you add for another ESP counts against the 10-DNS-lookup budget, and so does each distincta/mxmechanism without a cached result. Records with too manyinclude:statements fail evaluation entirely and are treated as a permerror. Flatten the record — consolidate ESPs, drop redundant mechanisms — or host a flattened version andinclude:that instead. - Missing -all / ~all entirely. A record like
v=spf1 mxwith no finalalldefaults unmatched senders to neutral, which tells receivers nothing. Every record should end in~allor-all. - Using deprecated ptr. The
ptrmechanism is DEPRECATED by RFC 7208 and should not be used — it requires a reverse DNS lookup, is unreliable, and is often ignored by receivers anyway. - SPF-only setups with no DKIM or DMARC. SPF alone leaves your domain exposed to "passing" forgery through forwarding chains, and gives you no visibility into who is sending as you. SPF is the first leg, not the whole stool.
SPF Is One Leg of the Triad: DKIM & DMARC
Modern email authentication uses three DNS records. SPF authorizes sending IPs; DKIM cryptographically signs the message so receivers can verify nothing was altered and it was not forged; DMARC tells receivers what to do with mail that fails both, and gives the domain owner a report of who is sending as them. SPF without DKIM is bypassed by forwarding, and neither means anything to a receiver unless a DMARC policy ties them together.
For the full setup picture — including the DKIM and DMARC halves — read the complete SPF, DKIM & DMARC guide and the DMARC setup guide, then verify each record with the DKIM Checker and the DMARC Analyzer. If you manage several domains, the combined SPF + DKIM + DMARC check audits all three at once, and the Domain Security Scorecard folds email authentication into your overall domain hygiene score. For DNS record lookups in general, the DNS Lookup tool shows TXT records alongside everything else.
FAQ: SPF Records
Does SPF stop all spoofing? No. SPF only tells receivers which IPs are authorized to send for your domain. It does not verify message content, and it can be bypassed in forwarding scenarios. Real email spoofing protection combines SPF with DKIM and DMARC — see the full guide.
Does SPF affect deliverability? It can. A hardfail (-all) on a message from an unlisted sender may get the mail rejected. Mistakes like a broken record or a mechanism that blocks a legitimate service can also cause real mail to be dropped. Check your record with the SPF Checker before tightening to -all.
How many DNS lookups do I get? Ten per evaluation (RFC 7208 §4.6.4). Each include: and each distinct a/ mx mechanism without a matching cached result counts against the limit.
Can I have more than one SPF record? No — a domain should publish exactly one SPF string. Multiple SPF records cause a permerror in many receivers, and the whole authentication fails. If you see more than one, merge them into a single record.