Skip to content
AdminKit

SPF ~all vs -all: what is the difference between softfail and hardfail?

In an SPF record, -all (hardfail) tells receivers that any server not listed is not authorized, while ~all (softfail) says it is probably not authorized and should be accepted but marked. With DKIM and DMARC in place the practical gap is small. AdminKit's free SPF check shows which ending your record uses.

By AdminKit team, Netbase JSC · Updated

Key takeaways

  • -all (hardfail) returns the SPF result Fail for any server your record does not list. ~all (softfail) returns SoftFail, a weaker “probably not authorized” result (RFC 7208 §2.6).
  • RFC 7208 leaves what happens to a Fail to the receiver. For SoftFail it says receivers should not reject the message on that result alone.
  • Market players disagree on the default. Microsoft recommends -all for Microsoft 365 domains that also use DKIM and DMARC. Google Workspace’s SPF setup page recommends ~all.
  • With DMARC in place, both endings count as an SPF failure. The real risk of -all is that some receivers reject on SPF before DMARC ever runs.
  • Run AdminKit’s free SPF check to see which ending your record uses and whether every sender is listed.

What do ~all and -all actually mean?

Every SPF record is read left to right. Each term either matches the sending server’s IP address or it does not. The all mechanism always matches, so it goes last and catches every server that nothing earlier matched. The symbol in front of it, called the qualifier, decides which result those servers get.

RFC 7208 §4.6.2 defines four qualifiers. If you write none, the default is +.

EndingQualifierSPF result for unlisted serversWhat RFC 7208 says about it
-all- (hardfail)Fail“An explicit statement that the client is not authorized” (§2.6.4). What to do is local policy (§8.4).
~all~ (softfail)SoftFail“A weak statement” that the host is probably not authorized. Receivers “SHOULD NOT reject the message based solely on this result” (§8.5).
?all? (neutral)NeutralNo statement either way. A record with no all and no redirect returns Neutral too (§4.7).
+all+ (pass)PassEvery IP address on the internet is authorized. The record protects nothing.

Here is the same record with the two endings:

v=spf1 include:_spf.mailbox-provider.example ip4:192.0.2.10 -all
v=spf1 include:_spf.mailbox-provider.example ip4:192.0.2.10 ~all

The provider domain and IP address are placeholders. For both records, mail from the provider and from 192.0.2.10 gets Pass. Only the result for everyone else changes.

What an SPF check result means covers all seven SPF results, including the PermError and TempError cases that no all ending can fix.

What do receivers really do with each result?

The RFC does not say “reject on Fail”. It says the outcome of a Fail is a matter of local policy, and that a receiver that does reject during the SMTP session should use reply code 550 with enhanced status 5.7.1. Appendix G.2 of RFC 7208 adds that rejecting on SPF Fail “does present some risk of rejecting legitimate email”, and that a Fail can also be one input into a wider score instead of a direct rejection.

Microsoft’s SPF documentation describes the same split in practical terms. For -all, messages “should be rejected” and are “typically discarded”, though the destination system decides. For ~all, messages “should be accepted but marked”, which may mean the spam folder, quarantine, or the inbox with a warning added.

So the choice between the two endings is not “reject vs deliver”. It is how strong a statement you want to make, given how sure you are that your record lists every real sender.

Why do Microsoft and Google recommend different endings?

The two largest mailbox providers give opposite defaults in their own setup guides:

SourceRecommended endingReason given
Microsoft Learn, SPF for Microsoft 365-allMicrosoft also recommends DKIM and DMARC. DMARC policy is effectively ignored for ~all failures when the message has no DKIM signature, so -all lets DMARC act on those messages.
Google Workspace Admin Help, Set up SPF~allThe ~all tag tells receivers to mark mail from unlisted servers as spam. Google’s example records all end in ~all.

Both are reasonable. Microsoft’s advice assumes you already run DKIM and DMARC. Google’s advice is the safer default for a domain owner who is still finding every service that sends mail as the domain. Neither is a wrong answer. What matters is that the ending matches how complete your record is.

How does DMARC change the choice?

DMARC passes when SPF or DKIM passes for a domain that matches the visible From address. DMARC.org’s overview describes this as checking whether the message “aligns” with what the receiver knows about the sender, and handling the non-aligned messages according to the domain’s published policy.

For DMARC, SoftFail and Fail are both SPF failures. That has two effects:

  1. If DKIM passes and aligns, the SPF ending usually does not matter. DMARC passes on DKIM alone.
  2. A -all can stop a message before DMARC is evaluated. RFC 9989 §7.1 warns that some receivers run SPF early in the SMTP session. A -all failure there can reject a message “that might otherwise pass DMARC due to an aligned DKIM-Authenticated Identifier”. Those rejected messages also never appear in your DMARC aggregate reports, because the receiver never saw the From header.

The second point is the strongest argument for ~all on a domain whose DMARC policy already handles enforcement. The first point is why Microsoft is comfortable recommending -all on domains that sign every message with DKIM.

What happens to forwarded mail?

When a mailing list or a mailbox rule forwards a message, the forwarding server sends it from its own IP address. That IP is not in your SPF record, so the forwarded copy fails SPF under either ending. With -all, a receiver that rejects on SPF Fail may bounce it. With ~all, it is more likely to be accepted and judged on DKIM and DMARC.

Why email forwarding breaks SPF explains SRS and ARC, the two mechanisms forwarders use to keep forwarded mail deliverable. DKIM signatures usually survive plain forwarding, which is one more reason to sign every message.

Which one should you publish?

Your situationSuggested endingWhy
New record, sender list still being confirmed~allA forgotten sender gets SoftFail, not a likely bounce, while you find it.
Every sender listed, DKIM signing on all of them, DMARC at quarantine or reject-all or ~allDMARC enforces either way. -all follows Microsoft’s advice; ~all avoids the early-rejection case in RFC 9989 §7.1.
Every sender listed, no DKIM, no DMARC yet~all, then add DKIM and DMARC-all here relies entirely on SPF, which breaks on forwarding. Fix authentication first.
Domain that never sends mail-allNothing legitimate can fail. Pair it with a DMARC p=reject record.
Record ends in +all or ?allChange it+all authorizes everyone; ?all makes no statement.

The ending is one character. The work is in the list in front of it. A record that ends in -all but misses your invoicing service will reject your own invoices at strict receivers.

How do you see which result a message got?

The ending you publish decides the result a receiver computes, and most receivers write that result into the message. Open the raw headers of a message from your domain and look for one of two lines:

  • An Authentication-Results header with an spf= value. It reads spf=pass for a listed server, spf=softfail for an unlisted server under ~all and spf=fail under -all. The Authentication-Results header glossary entry explains the other fields on that line.
  • A Received-SPF header, which RFC 7208 §9.1 defines for recording the same result, followed by the client IP and the envelope sender that were checked.
Authentication-Results: mx.receiver.example;
  spf=softfail smtp.mailfrom=sender.example

The host names above are placeholders. If you see softfail or fail on mail you sent yourself, the server that sent it is missing from your record. Paste the full headers into AdminKit’s email header analyzer to see the SPF, DKIM and DMARC results side by side, along with the sending IP you need to authorize.

How do you move from ~all to -all safely?

  1. List every sender. Mailbox provider, marketing platform, helpdesk, invoicing, website contact forms and any server that sends alerts. Add each one’s documented include: or IP address to your one SPF record.
  2. Publish DMARC in monitoring mode. A record such as p=none with a rua= address asks receivers to send aggregate reports. These show every source that sends as your domain and whether it passes. The DMARC check shows the policy you currently publish.
  3. Turn on DKIM for every sender that supports it. With aligned DKIM, DMARC passes even when SPF fails on a forwarded copy.
  4. Read the reports for a few weeks. Any legitimate source that still shows SPF fail is missing from your record.
  5. Switch the ending to -all if you decide to, and keep watching the reports for new failures after the change.

Keep the record under the 10 DNS lookups RFC 7208 allows while you add senders. Fixing SPF “too many DNS lookups” covers what to do when you hit the limit.

How do you check which ending your record uses?

Run AdminKit’s SPF check on your domain. It reads your published record, walks it the way a receiver does through nested includes, stops at the first all and explains how strict that ending is. It also counts DNS lookups against the limit of 10, so you can see whether adding a sender is safe. To test a draft record before you publish it, paste it into the SPF validator, which checks syntax and the lookup-causing terms without any DNS lookups.

Both tools are free and need no account. For how SPF works together with DKIM and DMARC, read SPF, DKIM and DMARC explained or the SPF glossary entry. This guide is part of AdminKit’s email authentication cluster.

This guide is general information, not a security audit of your specific network — see our disclaimer for what AdminKit's guidance does and does not commit to.

Frequently asked questions

Is -all better than ~all?

Neither is better in every case. -all is the stronger statement and Microsoft recommends it for Microsoft 365 domains that also use DKIM and DMARC. ~all is safer while you are still finding every service that sends mail as your domain, and it is what Google Workspace's own SPF setup page recommends. Pick -all once your sender list is complete and DMARC reports confirm it.

Will switching from ~all to -all stop spoofing of my domain?

Not on its own. SPF checks the envelope sender (the Return-Path), not the From address people see, and receivers decide for themselves what to do with a fail. DMARC is what ties SPF and DKIM to the visible From domain and publishes a policy receivers can act on. A strict SPF ending helps, but DMARC at quarantine or reject is what blocks direct spoofing of your From domain.

Can -all make my legitimate mail bounce?

Yes, if a legitimate sender is missing from the record. RFC 7208 says a receiver that rejects on a fail should use reply code 550, and RFC 9989 warns that some receivers check SPF before DMARC, so a -all fail can reject a message that would have passed DMARC through an aligned DKIM signature. Forwarded mail can also fail SPF because the forwarder's IP is not in your record.

What does ?all mean, and should I use it?

?all returns a Neutral result, which RFC 7208 treats the same as having no policy statement at all. Microsoft describes it as a value for testing and does not recommend it in production. A record with no all at the end and no redirect also returns Neutral by default (RFC 7208 §4.7), so ending with ?all adds no protection.

What about +all?

+all authorizes every IP address on the internet to send as your domain, because + is the Pass qualifier and all matches everything. It turns SPF into an open door. If your SPF check shows +all, replace it with ~all or -all after listing your real senders.

Does DMARC treat softfail and hardfail differently?

For DMARC, both are SPF failures. Microsoft's SPF documentation notes that DMARC treats -all and ~all as SPF failures, and that DMARC policy is effectively ignored for ~all failures when the message also has no DKIM signature. That is one reason Microsoft recommends -all for domains that publish DMARC.

Want AdminKit to watch this for you?

Free checks tell you the state today. Protective DNS and monitoring tell you when it changes.

Huy Nguyen (David), Founder and CEO of Netbase JSC

Talk to an expert

Huy Nguyen (David), Founder & CEO, Netbase JSC

Ask whether this fix applies to your setup, or get a second pair of eyes on your DNS and mail records.