An SPF record with a hard fail ends in -all, which tells receiving mail servers that any sender not listed in the record is unauthorized and should be rejected. It is the strictest SPF ending and suits domains that never send mail, or domains whose sending sources are fully mapped. For most active sending domains, a soft fail (~all) combined with DMARC at p=reject is safer, because a hard fail can block legitimate forwarded mail.
Key takeaways
- A hard fail (-all) instructs receivers to reject mail from servers not listed in your SPF record.
- With DMARC at p=reject, -all and ~all are treated identically as SPF failures — the difference is what happens without DMARC.
- Use -all for domains that never send mail; use ~all while you are still mapping senders, then enforce with DMARC.
One character at the end of your SPF record decides whether unauthorized mail gets rejected or merely flagged. That character is the difference between -all and ~all — and choosing wrong can either let spoofed mail through or block your own invoices.
What is an SPF record with a hard fail?
An SPF record with a hard fail is an SPF record that ends in -all. It tells every receiving mail server that any sender not listed in the record is explicitly unauthorized, and that mail from such a sender should be rejected.
SPF, or Sender Policy Framework, is a DNS TXT record that lists the mail servers allowed to send email for your domain. When a message arrives, the receiving server looks up your SPF record and checks whether the sending IP is on the list. The result is one of several outcomes defined in RFC 7208, the standard that defines SPF.
A typical hard-fail record for a domain using Google Workspace looks like this:
v=spf1 include:_spf.google.com -all
That record says: Google's servers may send mail for this domain, and nobody else may. The -all at the end is the instruction for everyone else. Compare it with the soft-fail version, which ends in ~all instead, and you have the whole debate in one character.
How does a hard fail work when mail arrives?
When a receiving server gets a message, it checks the IP address of the server that delivered it against your SPF record. If the IP is not listed and your record ends in -all, the SPF result is "fail", and the receiver may reject the message during the SMTP conversation.
Rejection usually means the message never reaches the inbox or the spam folder. The sender gets a bounce, often with a code such as 550 5.7.26, which signals an authentication failure. That is the strictest outcome SPF can produce.
But there is an important limit: not every receiver obeys the instruction the same way. RFC 7208 says a fail result means the sender is not authorized, but it leaves the final decision to the receiver. Most large providers do reject or heavily penalize hard-fail mail, yet some feed the result into a spam score instead. So -all is a strong request, not a guarantee.
What are the four SPF all qualifiers?
SPF defines four qualifiers for the all mechanism, but only two are sensible in practice. The all mechanism always matches, so its qualifier sets the policy for every sender not listed earlier in the record.
| Qualifier | Syntax | Meaning | Typical receiver behavior |
|---|---|---|---|
| Fail (hard fail) | -all | Sender is not authorized | Reject or heavily penalize the message |
| Soft fail | ~all | Sender is probably not authorized | Accept, then flag or send to spam |
| Neutral | ?all | No policy stated | No useful signal; treated like no SPF |
| Pass | +all | Every sender is authorized | Accept everything; defeats SPF entirely |
Neutral (?all) gives receivers no guidance at all, so it provides no protection. Pass (+all) is worse: it tells the world that any server may send mail as your domain. Never use either one. The real choice is always between -all and ~all.
What is the difference between a hard fail and a soft fail?
The difference is the strength of the statement you publish, not whether SPF passed. Both -all and ~all produce an SPF failure when an unlisted server sends mail; they differ in what you ask the receiver to do about it.
With a hard fail, you say the sender is definitely not authorized, and receivers should reject the message. With a soft fail, you say the sender is probably not authorized, and RFC 7208 explicitly says receiving software should not reject the message based on a softfail alone — though it may scrutinize it more closely.
In practice, a soft fail usually lands mail in spam or adds a warning, while a hard fail usually bounces it. The trade-off is forgiveness: a soft fail gives you room to fix a missing sender without losing mail, while a hard fail gives attackers no room at all.
Mimecast's comparison agrees: use a soft fail while verifying senders, and a hard fail only once legitimate mail streams are fully accounted for.
How does a hard fail interact with DMARC?
This is the point most guides get wrong: once DMARC is enforced at p=reject, the difference between -all and ~all largely disappears. DMARC treats both outcomes identically as an SPF failure.
DMARC checks whether SPF or DKIM passed and whether the authenticated domain aligns with the visible From domain. If SPF fails — hard or soft — and DKIM also fails or does not align, DMARC fails, and a p=reject policy tells receivers to reject the message. So with DMARC enforced, spoofed mail is rejected either way.
That is why many email security specialists now recommend ~all for active sending domains and enforcement through DMARC instead. You get the same protection against spoofing, without the risk that a hard fail blocks legitimate mail before DMARC ever gets a chance to evaluate it. Our guide to what DMARC is and how to set it up walks through the safe path from monitoring to p=reject.
There is one exception: receivers that do not check DMARC at all still see the difference. A hard fail is a stronger signal to them. But the large providers that matter most — Gmail, Outlook, Yahoo — all enforce DMARC, so this gap is shrinking.
When should you use an SPF hard fail?
A hard fail is the right choice in two situations. The first is a domain that never sends email. If you own a domain used only for a website, or a parked domain, publish v=spf1 -all and nothing else. That single record tells the world nobody may send mail as that domain, which shuts down spoofing of it completely.
The second is a domain whose sending sources are fully mapped and stable. If you have listed every service that sends mail for you — your mail provider, your CRM, your invoicing tool, your transactional mail service — and you have watched DMARC reports for several weeks without surprises, switching to -all is reasonable.
Before you switch, check your record with our free SPF checker to confirm it parses cleanly and counts your DNS lookups. SPF records are limited to 10 DNS lookups under RFC 7208, and exceeding that limit returns a permanent error that breaks authentication for all your mail, not just one sender.
When should you not use a hard fail?
Do not use -all while you are still discovering who sends mail for your domain. Most organizations have forgotten senders: an old marketing tool, a helpdesk, a printer that emails scans, a SaaS product that sends notifications. Any sender you miss will have its mail rejected.
Forwarding is the other classic trap. SPF checks the IP of the server that delivered the message, not the original sender. When someone forwards your mail, that server's IP is not in your SPF record, so SPF fails — and with -all, the forwarded message can be rejected even though nothing was misconfigured.
DKIM survives forwarding far better. See our guide to what DKIM is for how the signature works.
Also avoid -all if your mail flows through third-party services that change IPs often, or if you use mailing lists that rewrite senders. In those cases a soft fail plus DMARC enforcement protects you without the delivery risk.
How do you set up an SPF record with a hard fail?
Setting up a hard fail takes five steps, and the order matters. Do the discovery first and the tightening last.
- List every sender. Ask each team which tools send mail as your domain: your mail host, CRM, support desk, billing system, marketing platform and any transactional service.
- Publish SPF with
~allfirst. Start soft while you verify the list. A typical record isv=spf1 include:_spf.google.com include:sendgrid.net ~all— replace the includes with your own providers. - Publish DKIM and DMARC. Add DKIM signing for each sender and a DMARC record starting at
p=noneso you receive reports without rejecting anything yet. - Watch DMARC reports for two to four weeks. Look for legitimate sources failing SPF or DKIM, and add any missing includes or fix DKIM alignment.
- Switch to
-alland move DMARC top=reject. Change the final~allto-allin your DNS TXT record, then tighten DMARC. Keep watching reports for another month.
For a domain that never sends mail, skip straight to step five: publish v=spf1 -all as your only SPF record, plus a DMARC record at p=reject.
What are the most common SPF hard fail mistakes?
The most common mistakes all come from treating SPF as a one-time setup instead of a living record. Here are the ones that cause real outages.
- Publishing two SPF records. A domain may have only one SPF record. Two TXT records starting with
v=spf1cause a permanent error, and SPF fails for every message. - Forgetting a sender. A new SaaS tool starts sending invoices, nobody adds its include, and with
-allthose invoices bounce. - Exceeding 10 DNS lookups. Each
include:,a,mxandredirectcounts toward the RFC 7208 limit of 10. Nested includes count too, so four or five third-party senders can quietly push you over. - Using
+allor?allby accident. A typo turns your strict record into an open invitation. Always verify the final character after any edit. - Assuming SPF stops spoofing alone. SPF checks the envelope sender, not the visible From address. Without DMARC, an attacker can pass SPF with their own domain while displaying yours in the From field.
Phishing remains the most reported internet crime in the US: the FBI's IC3 received 191,561 phishing and spoofing complaints in 2025, and business email compromise cost victims about $3.05 billion. SPF with a hard fail is one layer of defense against that — not the whole defense. Spear phishing in particular often uses look-alike domains that your SPF record cannot touch, as our spear phishing guide explains.
How do you check whether your SPF record uses a hard fail?
You can check in under a minute. Run a DNS lookup for your domain's TXT records and look for the record starting with v=spf1. If it ends in -all, you have a hard fail; if it ends in ~all, a soft fail.
From a terminal, dig TXT yourdomain.com +short shows the record directly. Or use our free SPF checker, which parses the record, flags a missing or duplicate record, and counts your DNS lookups against the 10-lookup limit.
Also check your mail headers. A received message's Authentication-Results header shows the SPF result for that message — spf=pass, spf=fail or spf=softfail — which tells you how receivers actually evaluated your record. Our email header analyzer reads those headers for you.
The bottom line
An SPF record with a hard fail (-all) is the strictest SPF ending: it tells receivers to reject mail from any server you did not authorize. Use it for domains that never send mail, and for sending domains only after your sender list is complete and verified.
For most businesses, the safer path is ~all plus DMARC at p=reject, which gives you the same spoofing protection without the risk of bouncing legitimate forwarded mail. Check your record today with the free SPF checker and confirm it ends the way you intended.
Frequently asked questions
What does an SPF record with a hard fail mean?
It means your SPF record ends in -all, which tells receiving mail servers that any server not listed in the record is not authorized to send mail for your domain, and that such mail should be rejected.
Is -all or ~all better for SPF?
For most active sending domains, ~all is the safer choice while you confirm every legitimate sender, because a mistake only sends mail to spam instead of rejecting it. Use -all for domains that never send mail, or once your sender list is complete and stable.
Does a hard fail stop spoofing on its own?
No. SPF only checks the envelope sender, not the address people see in the From field, and it breaks when mail is forwarded. You also need DKIM and DMARC at p=reject to stop spoofing of your visible domain.
Can a hard fail block legitimate email?
Yes. If a real sending service is missing from your SPF record, or mail is forwarded through a server you did not authorize, receivers can reject it outright. That is the main risk of -all.
How do I change my SPF record from ~all to -all?
First confirm every service that sends mail for your domain is listed, watch DMARC reports for a few weeks, then change the final ~all to -all in your DNS TXT record. Keep monitoring reports after the change.
What is the difference between SPF fail and SPF softfail?
Both mean the sending server was not authorized by your SPF record. A fail (-all) is a strong statement that the mail should be rejected, while a softfail (~all) says the sender is probably not authorized and leaves the decision to the receiver.
Do I need SPF if I already have DMARC?
Yes. DMARC relies on SPF or DKIM passing and aligning with your From domain. Without a valid SPF record, DMARC has one fewer way to authenticate your mail.
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, Valimail and Mimecast guidance on SPF qualifiers, and the FBI IC3 2025 report.
How we write and fact-check →