SPF ~all vs -all: softfail or hardfail?

What each ending of an SPF record tells receivers, and which one to use once DMARC is in place.

The last part of an SPF record tells receivers what to think of servers that aren't listed:

EndingResultMeaning
-allfailUnlisted servers are not allowed to send for this domain.
~allsoftfailUnlisted servers probably aren't allowed; treat with suspicion.
?allneutralNo statement. Protects nothing.
+allpassEvery server on the internet may send as you. Never use this.

Which one to use

With DMARC in place, use ~all. DMARC decides what happens to mail that fails, and it treats softfail and fail the same way. The difference is what happens before DMARC: some receivers reject a message outright on an SPF fail, without looking at DKIM. That can bounce legitimate mail that was forwarded, even though its DKIM signature would have passed DMARC. ~all leaves the decision to DMARC, which considers both.

Use -all for domains that don't send email at all (v=spf1 -all), or if you have no DMARC policy and want the strongest SPF statement. Both are fine; the real protection comes from DMARC at quarantine or reject.

Never use ?all or +all. +all in particular turns SPF into a pass for any spammer. It sometimes appears after someone "fixed" bounces by allowing everything.