Skip to main content
Enter TitanOS

What is SPF

What Is an SPF Record? A Plain Guide for Small Business, With Examples

By , Brisbane. Published 29 November 2026. Last reviewed 29 November 2026. How we write and check. About 9 minute read. General information, not legal advice.

An SPF record is a line of text in your domain's DNS that lists which mail servers are allowed to send email for your domain. SPF stands for Sender Policy Framework. When a message arrives claiming to be from you, the receiving server looks up your SPF record, checks whether the server that delivered the message is on your list and records a pass or a fail.

It sounds simple, and it is, until a business has five services sending email and an SPF record that has grown by accident. This guide explains the syntax in plain words, shows examples, covers the ten-lookup limit that breaks many records, explains the difference between the endings ~all and -all and lists the errors that cause most failures. It also explains what SPF cannot do, because many owners expect more from it than it delivers.

How SPF works

SPF is defined in RFC 7208. The check goes in four steps.

  1. A mail server connects to the receiver and says it has a message from someone at your domain. It gives an envelope sender address, also called the MAIL FROM or return path, along with its own IP address.
  2. The receiver looks up the TXT record on the domain in that envelope address and finds the one that starts with v=spf1.
  3. It checks whether the connecting IP address matches any rule in the record, working left to right.
  4. The first rule that matches decides the result: pass, fail, softfail, neutral. If nothing matches, the final term decides.

The key detail is that SPF checks the envelope sender, not the From address a person sees. A scammer can use their own domain in the envelope, pass SPF for it and still show your domain in the visible From line. DMARC closes that gap by requiring the two to align.

SPF syntax in plain words

An SPF record is one line. It starts with a version tag, lists mechanisms that say who may send and ends with a rule for everyone else.

The pieces of an SPF record
PieceWhat it meansNotes
v=spf1This is an SPF recordMust be first
ip4: and ip6:Allow this address or rangeCheap, no extra DNS lookup
aAllow the address of the domain's own A recordCounts as a lookup
mxAllow the domain's mail serversCounts as a lookup
include:Also allow whatever the named domain's SPF record allowsCounts as a lookup, plus any lookups inside it
redirect=Use another domain's whole record insteadCounts as a lookup
allMatches everything else, used lastPreceded by a qualifier, see below

Each mechanism can carry a qualifier in front. A plus means pass and is the default. A minus means fail. A tilde means softfail. A question mark means neutral. You will most often see the tilde and the minus on the closing all.

~all or -all: which should you use?

The closing rule
EndingNameWhat you are telling receivers
-allFail (hard fail)Mail from anywhere not listed is not authorised
~allSoftfailMail from anywhere not listed is probably not authorised, but treat it with suspicion rather than reject it outright
?allNeutralNo opinion
+allPassAnyone may send as this domain. Never use this.

Many mail systems treat ~all and -all alike in practice and let DMARC make the call. Once DMARC is published at quarantine or reject, the receiver's decision is driven by DMARC and SPF is one input. Common practice is to use ~all while you are still finding every sender and -all when you are sure the list is complete. Both are acceptable. The one to avoid is +all, which authorises the entire internet, and a record with no closing term at all.

One caution on -all: it can cause legitimate forwarded mail to fail SPF, because a forwarding server is not on your list. DMARC lets DKIM rescue the message in that case, which is a good reason to set up DKIM as well.

The ten lookup limit

RFC 7208 limits an SPF check to ten DNS lookups. Mechanisms that need a DNS query count toward the limit: include, a, mx, ptr, exists and redirect. The ip4 and ip6 mechanisms do not. Lookups inside an included record count too, so one include for a large provider can use several. If a check needs more than ten, the result is a permanent error, and receivers may treat the message as failing SPF even though every sender is legitimate.

This catches growing businesses. A record starts with Microsoft 365 or Google, then adds an accounting package, a newsletter tool, a CRM, a booking system and a helpdesk. Each include is a lookup and some add several more.

How to stay under the limit

  • Remove services you no longer use. Old includes are the most common cause. Check each one against your sender list.
  • Replace a, mx and include with ip4 where addresses are fixed. Only do this for servers whose addresses will not change, and not for cloud providers who change them often.
  • Move marketing and bulk services to a subdomain. Send newsletters from news.yourbusiness.com.au with its own SPF record. The subdomain has its own count of ten.
  • Prefer DKIM for third-party senders. A service that signs with your domain passes DMARC through DKIM, so it does not need to be in your SPF record at all.
  • Consider SPF flattening tools only with care. They replace includes with address lists and need to be kept up to date, or the record goes stale and legitimate mail fails.

Our email spoofing check shows the record it finds. Count the includes in it. A record with more than six or seven is worth a review.

Examples for common setups

Always take the include value from your provider's own help page, because they change. The examples below use the values published by Microsoft and show the shape. Others are placeholders.

Example SPF records
SetupExample record
Microsoft 365 onlyv=spf1 include:spf.protection.outlook.com -all
Microsoft 365 plus one other servicev=spf1 include:spf.protection.outlook.com include:_spf.vendor.example ~all
A domain that never sends emailv=spf1 -all
Your own server at a fixed address plus Microsoft 365v=spf1 ip4:203.0.113.25 include:spf.protection.outlook.com ~all

The second to last row is worth copying onto every domain you own but do not send from, such as an old trading name. Pair it with a DMARC record of v=DMARC1; p=reject on the same domain. Microsoft recommends both for parked domains.

Google Workspace and other providers publish their own include values. Use theirs exactly, and use only one SPF record on the domain. If you already have an SPF record and want to add a service, edit the record you have. Do not add a second.

The mistakes behind most SPF problems

Common SPF errors
ProblemSymptomFix
Two SPF records on one domainPermanent error, receivers may ignore SPFMerge them into one
More than ten lookupsPermanent error even though senders are genuineTrim includes, move bulk senders to a subdomain
A service sends but is not listedSPF fails for that service's mailAdd the vendor's include, or use DKIM for that sender
Record not at the domain rootSPF not foundPublish at the bare domain, not a subdomain, unless you intend a subdomain record
Typing mistakesA record that starts v=spf instead of v=spf1, or a missing space between termsRetype carefully and test
Using +allAnyone may send as youChange to ~all or -all
Using the old SPF record typeReceivers read TXT recordsPublish SPF as TXT. The separate SPF record type was deprecated by RFC 7208.
Forgetting subdomains that sendMail from a subdomain failsGive each sending subdomain its own SPF record

A permanent error is called a permerror in the specification. Check your DMARC reports or message headers for spf=permerror, which is a sure sign of one of the first two issues.

What SPF cannot do

  • It does not check the From address people see. That is DMARC's job through alignment.
  • It breaks when mail is forwarded. The forwarding server is not on your list, so SPF fails for the forwarded copy. DKIM usually survives.
  • It does not stop lookalike domains. A scammer's own domain passes its own SPF.
  • It does not stop a hacked mailbox. Mail from a compromised account comes from your authorised servers.
  • It says nothing about the content of a message. A pass does not mean wanted or safe.

None of this makes SPF pointless. It is a cheap, standard signal that receivers expect, and it is half of what DMARC needs. For the full path, our DMARC for Microsoft 365 guide shows a safe rollout, and the DMARC and SPF setup guide gives the exact records. If your concern is forged invoices, read invoice fraud email scams.

How to create or fix your SPF record

  1. Look up your current record with the email spoofing check. Copy what is there before you change anything.
  2. List every service that sends mail as your domain. Include your mailboxes, accounting, quoting, website forms, newsletters and printers.
  3. For each one, find the vendor's SPF instructions and note the include value or address.
  4. Write one record: v=spf1, then your mechanisms, then ~all or -all.
  5. Count the lookups. Stay at ten or under, and preferably well under.
  6. Edit the existing TXT record at your DNS host. Do not add a second.
  7. Check the result and send a test message to an outside address. In the headers look for spf=pass.
  8. Publish DMARC at p=none and read the reports so you catch any sender you missed.

If you would rather have the records checked for you, the Instant Email Domain Check gives a written report from public records, and the Compliance Monitor keeps checking so a new tool does not quietly push you over the limit.

Questions people ask

What is an SPF record?

It is a TXT record in your domain's DNS that lists the servers allowed to send email for your domain. Receiving servers check it to decide whether a message came from an authorised sender. It begins with v=spf1 and usually ends with ~all or -all.

What is the difference between ~all and -all?

-all is a hard fail: mail from servers not listed is not authorised. ~all is a softfail: such mail is probably not authorised but should be treated with suspicion, not rejected on SPF alone. Both are acceptable, and DMARC makes the final call. Never use +all.

Can I have two SPF records?

No. Two records beginning v=spf1 on the same domain cause a permanent error, and receivers may ignore SPF altogether. Merge everything into a single record.

What does too many DNS lookups mean for SPF?

RFC 7208 allows a maximum of ten lookups per SPF check. Include, a, mx, ptr, exists and redirect each count, including lookups inside included records. Going over gives a permerror. Trim unused includes or use a subdomain for bulk senders.

Does SPF stop spoofing on its own?

No. SPF checks the envelope sender, not the From address people see, so a scammer can pass SPF for their own domain while showing yours. DMARC at quarantine or reject is what ties the two together.

Do I need an SPF record for a domain that does not send email?

Yes, it is a good idea. Publish v=spf1 -all and a DMARC record of p=reject so nobody can forge mail from the domain. This is Microsoft's recommended approach for parked domains.

How long does an SPF change take?

It depends on the record's TTL, the time DNS caches are kept. Many are set to between a few minutes and a few hours. Allow up to a day for the change to be seen everywhere and check again after that.

Go deeper

More guides

See the SPF record your domain publishes today, and whether DKIM and DMARC sit alongside it. The check reads public DNS only and explains each result in plain words.

Look up your SPF record

Related reading

Sources

  1. RFC 7208: Sender Policy Framework (SPF). The specification, including the limit of 10 DNS lookups and permerror
  2. RFC 7489: DMARC. How DMARC uses SPF alignment
  3. RFC 6376: DKIM Signatures. The companion record
  4. Microsoft Learn: Set up DMARC to validate email in Microsoft 365. Parked domains and staged rollout
  5. Google: Email sender guidelines. Authentication expectations for senders
Book a free call