An SPF record, short for Sender Policy Framework, is a DNS TXT record listing which mail servers may send email for your domain. A receiving server looks it up, compares the sending server's IP address with the list, and passes or fails the check. SPF is defined in RFC 7208, always starts with v=spf1, and sits alongside DKIM and DMARC as a core email authentication standard.
Key takeaways
- An SPF record is a single DNS TXT record starting with v=spf1 that lists your authorised sending servers.
- Receiving servers check the Return-Path domain, not the From address you see, and SPF alone cannot stop look-alike domains.
- Keep your record under the 10 DNS lookup limit, end it with -all once tested, and pair it with DKIM and DMARC.
Anyone can send an email that claims to come from your domain. That is how it was designed, and it is why phishing works. An SPF record is the first line of defence: a short entry in your DNS that tells every receiving server which mail servers are allowed to send on your behalf.
What is an SPF record?
An SPF record, short for Sender Policy Framework, is a DNS TXT record at your domain that declares which IP addresses and servers are authorised to send email on behalf of that domain.
When a message arrives at a receiving mail server, the server looks up the SPF record in DNS, parses the authorised list, and compares the connecting IP address against it, as NSLookup.io's practical guide explains. If the server is on the list, SPF passes. If it is not, the message may be rejected, quarantined or sent to spam.
SPF is defined in RFC 7208, published in April 2014 as a proposed standard, which obsoleted the earlier experimental RFC 4408. It is one of three core email authentication standards, alongside DKIM (RFC 6376) and DMARC (RFC 7489).
You can read our guide to what DKIM is for the second standard.
Our guide to what DMARC is covers the third standard, which ties SPF and DKIM together with a policy.
How does an SPF record work?
SPF works in the background on every email, in a few seconds, without the recipient seeing anything. The check happens before the message body is even read.
- A server sends mail. Your mail provider connects to the receiving server and says who the mail is from, in the SMTP envelope. That address is the Return-Path, also called the envelope-from.
- The receiver looks up SPF. It extracts the domain from the Return-Path and does a DNS TXT lookup for that domain to fetch the SPF record.
- It compares the IP. The receiver checks whether the connecting server's IP address matches any mechanism in the record, working left to right until it finds a match.
- It returns a result. Pass, fail, softfail, neutral, none or an error, depending on the match and the record's ending.
That last point matters. SPF validates the Return-Path value, not the From address shown in your inbox. An attacker can pass SPF with their own domain in the Return-Path while showing your domain in the From header. That is why SPF alone is not enough, and why DMARC alignment, which checks that the SPF domain matches the From domain, is essential.
How do you read an SPF record?
Every SPF record starts with v=spf1, then a space-separated list of mechanisms, and ends with a rule for everything else. The receiver processes the record from left to right and stops at the first match.
Here is a typical example:
v=spf1 a mx include:_spf.google.com -all
| Part | What it means | Example |
|---|---|---|
| v=spf1 | Version tag, required, always first | v=spf1 |
| a | Authorises the IP addresses in the domain's A records | a |
| mx | Authorises the domain's mail servers from its MX records | mx |
| ip4: / ip6: | Authorises a specific IP address or range | ip4:192.0.2.0/24 |
| include: | Authorises the SPF record of another domain, such as a mail provider | include:_spf.google.com |
| all | Matches every other server; the qualifier before it decides the result | -all |
Each mechanism can carry a qualifier, placed directly in front of it. The four qualifiers, defined in RFC 7208, are: + for pass, the default when no qualifier is written; - for fail, meaning the server is explicitly not authorised; ~ for softfail, meaning probably not authorised, often used while rolling out a policy; and ? for neutral, meaning no assertion either way.
So -all means fail for anything not listed, while ~all means softfail. Start with ~all while you test, then move to -all once you are sure every legitimate sender is listed.
SPF vs DKIM vs DMARC: what is the difference?
SPF, DKIM and DMARC are often confused because they work together. Each one checks a different thing, and each one has a gap the others fill.
| SPF | DKIM | DMARC | |
|---|---|---|---|
| What it checks | Sending server is authorised for the domain | Message signature is valid and content unchanged | SPF or DKIM aligns with the From domain |
| What it proves | Where the mail came from | Who signed it and that it was not altered | That the visible sender is authenticated |
| Published as | DNS TXT record, v=spf1 | DNS TXT record with a public key | DNS TXT record at _dmarc |
| Main gap | Does not check the From address; breaks on forwarding | Does not say what to do on failure | Needs SPF or DKIM to work |
| Stops | Exact-domain spoofing in the envelope | Tampering in transit | Exact-domain spoofing in the From header |
SPF alone does not stop phishing, because it does not check the From address and it breaks when mail is forwarded. DKIM survives forwarding better, because the signature travels with the message. DMARC ties them together and tells receivers to reject mail that fails both. That is why Google, Yahoo and Microsoft now require all three from bulk senders.
Why does an SPF record matter in 2026?
SPF is no longer optional. Since February 2024, Gmail requires SPF or DKIM for all senders to personal Gmail accounts, and both SPF and DKIM, plus a DMARC record, for bulk senders, defined as those sending close to 5,000 or more messages a day to personal Gmail accounts.
Google's sender guidelines also require valid forward and reverse DNS, TLS, a spam complaint rate below 0.3%, and one-click unsubscribe for marketing mail. Starting in November 2025, Gmail ramped up enforcement on non-compliant traffic, with temporary and permanent rejections for messages that fail the requirements.
Without SPF, your mail is more likely to be rejected or sent to spam, and attackers can more easily forge mail from your domain. With SPF, spammers and phishers are less likely to forge your domain, because forged mail is more likely to be caught by spam filters that check the record.
For a small business, the cost of not having SPF is quiet and hard to see: invoices that land in spam, password resets that never arrive, and customers who stop trusting mail from your domain. You can check your own domain in seconds with our free SPF checker.
How do you create an SPF record?
Creating an SPF record takes ten minutes, but do it carefully. A wrong record can break legitimate mail, and a record with too many lookups fails entirely.
- List every service that sends mail for your domain. Include your mail provider, your website, your CRM, your marketing tool, your invoicing system and any other service that sends as you. Ask each provider for its SPF include value.
- Write one record. Start with
v=spf1, add your mechanisms, and end with~allwhile testing. For example, a Google Workspace domain might usev=spf1 include:_spf.google.com ~all. - Publish it as a TXT record. In your DNS provider, add a TXT record at your domain's apex, the bare domain with no subdomain, with the record as its value. Publish only one SPF record per domain.
- Wait for DNS to propagate. This usually takes minutes to a few hours, depending on your DNS provider's TTL.
- Test it. Send test mail from every service you listed and check the headers for SPF pass. Use our free SPF checker to verify the record, count lookups and flag errors.
- Move to -all. Once every legitimate sender passes, change
~allto-allso unauthorised servers fail outright.
What is the SPF 10 DNS lookup limit?
RFC 7208 limits SPF evaluation to 10 DNS lookups. If your record triggers more than 10, the whole record is thrown out with a PermError, no matter how correct the rest of it is. The limit also caps void lookups at 2.
Each include, a, mx, ptr and exists mechanism can trigger lookups, and an include can trigger several more inside the included record. A typical SPF record with a few includes can hit the limit quickly, especially if your providers include other providers in turn.
- Count every include. Check how many lookups each included record uses, not just your own.
- Use ip4 and ip6 directly for servers with fixed addresses. Direct IPs cost no DNS lookups.
- Avoid ptr. The ptr mechanism is slow, lookup-heavy and discouraged.
- Flatten includes if you keep hitting the limit: replace an include with the IP addresses it contains, and update them when the provider changes them.
- Remove services you no longer use. Old marketing tools and retired providers are a common cause of lookup bloat.
What are common SPF record mistakes?
Most SPF failures are not attacks. They are configuration mistakes that are easy to make and easy to fix once you know them.
- Multiple SPF records. Two v=spf1 records on the same domain cause a PermError. Combine them into one.
- Missing senders. Forgetting a service, such as your website's contact form or your invoicing tool, means its mail fails SPF and lands in spam.
- Too many lookups. More than 10 DNS lookups fails the whole record. Count them with an SPF checker.
- Wrong domain. Publishing the record on a subdomain, or on the wrong domain, means receivers never find it.
- Syntax errors. A missing space, a typo in an include, or a record longer than 255 characters per string breaks parsing. DNS TXT strings are limited to 255 characters each, so long records need to be split correctly.
- Staying on ~all forever. Softfail is a testing step, not a policy. Move to -all once testing is done, and add DMARC at p=reject for real enforcement.
- Thinking SPF alone is enough. SPF does not check the From address and does not survive forwarding well. Pair it with DKIM and DMARC.
If your mail is landing in spam, check your SPF record first, then your DKIM and DMARC records. Our free email security score checks all three together and shows what is missing.
The bottom line
An SPF record is a short, free DNS entry that tells the world which servers may send mail for your domain. It is defined in RFC 7208, it starts with v=spf1, and it is required by Gmail for anyone sending to personal Gmail accounts.
Publish one record, list every legitimate sender, stay under 10 DNS lookups, test with ~all, then move to -all, and pair SPF with DKIM and DMARC. That combination is what stops exact-domain spoofing and keeps your mail out of spam. Check your domain now with the free SPF checker.
Frequently asked questions
What is an SPF record in simple terms?
An SPF record is a note in your domain's DNS that says which servers are allowed to send email for you. When a server receives your email, it checks that note. If the sender is on the list, the email passes SPF. If not, it may be rejected or sent to spam.
What is the difference between SPF, DKIM and DMARC?
SPF checks whether the sending server is authorised for your domain. DKIM adds a digital signature that proves the message was not changed in transit. DMARC ties them together, tells receivers what to do when checks fail, and adds reporting. You need all three for strong protection.
Does SPF stop phishing?
It helps, but it does not stop phishing on its own. SPF stops attackers from sending email that uses your exact domain in the Return-Path, but it cannot stop look-alike domains, and it does not check the From address you see in your inbox.
How many SPF records can a domain have?
Only one. A domain must publish at most one SPF record. RFC 7208 treats multiple v=spf1 TXT records on the same name as an error, so if you use several mail providers, combine them into one record.
What does -all mean at the end of an SPF record?
The -all ending means fail: any server not listed in the record is explicitly not authorised. The softer ~all means softfail, which asks receivers to treat unauthorised mail as suspicious rather than rejecting it outright.
What is the 10 DNS lookup limit in SPF?
RFC 7208 limits SPF evaluation to 10 DNS lookups. If your record triggers more than 10, through mechanisms such as include, a, mx and ptr, the whole record fails with a PermError, no matter how correct the rest of it is.
How do I check my SPF record?
Use a free SPF checker, such as Cysoro's SPF checker, or run a DNS lookup for the TXT records on your domain. The checker shows your record, counts DNS lookups, and flags errors such as multiple records or too many lookups.
Do I need SPF if I only send a few emails?
Yes. Since February 2024, Gmail requires SPF or DKIM from all senders to personal Gmail accounts, and SPF and DKIM from bulk senders. Without it, your mail is more likely to be rejected or sent to spam.
Sources
The engineers and analysts who build Cysoro's domain scanner, email-authentication checks and free security tools. We test what we write about every day — SPF, DKIM, DMARC, certificates, look-alike domains and phishing — and check each guide against the relevant standards, government guidance and vendor documentation.
Checked against RFC 7208 as summarised by Wikipedia and NSLookup.io, and Google's email sender guidelines.
How we write and fact-check →