What Is an SPF Record?

Category: Email Hosting ยท Updated 2026-11-01

An SPF (Sender Policy Framework) record is a DNS TXT entry that lists which mail servers are allowed to send email on behalf of your domain. Receiving mail servers check this list against the sending server's address, and mail from a server not on the list can be marked as spam or rejected. A domain should have exactly one SPF record.

Why SPF exists

Email's original design lets anyone put any "From" address on a message, which makes it easy to forge. SPF addresses this by letting a domain owner publish, in DNS, exactly which mail servers are authorized to send mail claiming to be from that domain. A receiving server looks up the SPF record for the sender's domain and checks whether the connecting server's IP address is on the approved list.

Basic SPF syntax

An SPF record is a TXT record at the root of the domain. A simple example:

example.com.  TXT  "v=spf1 ip4:203.0.113.10 include:_spf.google.com ~all"
PartMeaning
v=spf1Marks this as an SPF record, version 1
ip4: / ip6:Authorizes a specific IP address or range
a / mxAuthorizes the domain's own A or MX records
include:Pulls in another domain's SPF rules, common for services like Google Workspace or a marketing platform
allCatch-all for anything not matched above

The qualifier before a mechanism controls what happens on a non-match: -all (fail, reject non-matching senders), ~all (softfail, usually deliver but mark as suspicious) or ?all (neutral, no real opinion). Most domains start with ~all and move to -all once they are confident every legitimate sender is listed.

Common mistakes

  • Multiple SPF records: a domain must have only one SPF TXT record. Two records cause a "permerror" and SPF checks fail entirely; merge the mechanisms into a single record instead.
  • Exceeding 10 DNS lookups: each include adds lookups, and SPF evaluation stops checking and fails once the limit is exceeded, which happens easily with several third-party services chained together.
  • Forgetting a sending service: if you add a new email marketing tool or CRM that sends on your behalf, its servers need to be included or its mail may be flagged as spoofed.
  • Using -all too early: switching straight to a hard fail before confirming every legitimate sender is listed can cause real email to bounce.

SPF, DKIM and DMARC work together

SPF only checks the sending server's IP address against a list; it does not verify that the message content was not altered and it does not stop spoofing of the visible "From" name shown to a reader in all cases. DKIM adds a cryptographic signature that proves the message was not tampered with in transit. DMARC builds on both, telling receiving servers what to do when SPF or DKIM checks fail and sending reports back to the domain owner. Setting up all three gives the strongest protection against spoofing and phishing using your domain.

Checking your SPF record

dig TXT example.com +short
nslookup -type=TXT example.com

Several free online SPF checker tools will also parse a record and flag syntax errors or lookup limits, which is useful before publishing a change to a live domain.

Frequently asked questions

What is an SPF record?

An SPF record is a DNS TXT entry that lists the mail servers authorized to send email for a domain, so receiving servers can check whether a message really came from where it claims.

How do I check if a domain has an SPF record?

Run a DNS TXT lookup on the domain, for example with "dig TXT example.com" or an online SPF checker tool, and look for a value starting with "v=spf1".

Can a domain have two SPF records?

No. A domain must publish exactly one SPF TXT record. Having two causes SPF validation to fail with a permanent error, so any additional senders must be merged into the single existing record.

What is the difference between SPF, DKIM and DMARC?

SPF checks whether the sending server's IP is authorized, DKIM verifies the message was not altered using a digital signature, and DMARC tells receiving servers what action to take when SPF or DKIM fail, plus provides reporting. They are complementary, not interchangeable.

What happens if I do not set up an SPF record?

Without SPF, receiving mail servers have less basis to trust that your domain's email is legitimate, which increases the chance your messages are marked as spam, and makes it easier for others to spoof your domain in phishing emails.

How many DNS lookups does SPF allow?

SPF evaluation is limited to 10 DNS lookups caused by mechanisms like include, a and mx. Exceeding that limit causes the SPF check to fail (permerror) regardless of whether the sender is actually authorized.

Related topics