Skip to content
Claim your free business email

SPF record: what it is, an example, and how to create and check one

SPF record explained: a short list of approved servers beside a domain, with one envelope passing a check.

An SPF record is one TXT record in your domain’s DNS that lists the servers allowed to send email as your domain. It starts with v=spf1, names each sender, and ends with an all term for everyone else. Receivers compare the sending server with that list. Our SPF checker reads yours in seconds.

What is an SPF record?

An SPF record is the list of mail servers your domain vouches for, published where any receiver can read it. When a message arrives, the receiving server takes the domain from the envelope sender (the return path, which bounces go back to), looks up that domain’s SPF record, and asks one question: is the server that just connected on the list?

The answer is one of a handful of results. pass means the server is listed. fail and softfail mean it is not, and the record asked receivers to reject or to distrust such mail. neutral and none say nothing either way, and permerror means the record itself is broken. The standard is RFC 7208.

SPF does not stop spoofing on its own. It checks the return-path domain, which a forger can set to a domain they control, while the reader sees the From address. That gap is what DMARC closes, and it is why SPF can pass on mail that still fails (the last question below). The SPF glossary entry has the one-paragraph version, and DKIM, SPF and DMARC explained shows how the three records work together.

Gmail, Yahoo and Outlook all ask senders for it. Gmail and Yahoo require SPF or DKIM from every sender, and both plus DMARC from bulk senders, which at Gmail means more than 5,000 messages a day. Outlook.com requires SPF, DKIM and DMARC from domains that send it more than 5,000 a day. The Gmail and Yahoo sender requirements guide lists each rule.

What does an SPF record look like?

An SPF record looks like a single line of text: v=spf1, then one term per sender, then all. Here is an SPF record example, as a DNS lookup prints it, for a business that runs a server of its own, reads mail at a mail host, and sends a newsletter through a third service:

example.com.  3600  IN  TXT  "v=spf1 ip4:192.0.2.0/24 include:_spf.mailhost.example include:spf.newsletter.example ~all"

Read left to right, each term says one thing:

v=spf1                          the version tag: this TXT record is an SPF record
ip4:192.0.2.0/24                your own servers' addresses (no DNS lookup)
include:_spf.mailhost.example   your mail host's servers (1 lookup, plus its own)
include:spf.newsletter.example  a newsletter service's servers (1 lookup, plus its own)
~all                            everyone else: soft fail

The SPF record syntax is short. Receivers read the terms in order and stop at the first one that matches the sending server. A term is a mechanism (what to match) with an optional qualifier in front (what result a match gives). With no qualifier, a match is a pass.

SPF record syntax: the mechanisms
TermMatchesDNS lookups
ip4:192.0.2.0/24An IPv4 address or rangeNone
ip6:2001:db8::/32An IPv6 address or rangeNone
include:_spf.mailhost.exampleWhatever that domain's own SPF record passes1, plus every lookup inside it
aThe addresses your domain name points at1
mxThe servers that receive your mail1
exists:A name that resolves, usually built with macros1
ptrReverse DNS. The standard says not to use it1
allEvery server: always the last termNone
redirect=Use another domain's record instead, when nothing else matched1

Two smaller records cover two common cases. A domain whose own mail server sends its mail can start with this one, which is what our checker suggests when it finds no record:

v=spf1 mx ~all

A domain that sends no mail at all, such as a parked domain, should say so, which stops anyone passing SPF with it:

v=spf1 -all

How do I create an SPF record?

You create an SPF record by listing every service that sends mail as your domain, writing them into one v=spf1 line, and saving it as a TXT record at the domain itself in your DNS host’s panel. The SPF record generator writes the line for you: add your mail host’s include, other sending services and your own IP addresses, choose the ending, and copy the record. It counts the DNS lookups its own terms make, and the SPF checker below follows every include once the record is live.

Here is how to create an SPF record, step by step:

  1. List every sender — Write down every service that sends mail as your domain: your mail host, a newsletter or marketing tool, your shop or billing system, and any server of your own. Check your DMARC reports or your sent receipts if you are unsure.
  2. Collect each include or address — Each service's setup page gives a value that starts with include:. For your own servers, note their IP addresses or ranges, which go in as ip4: or ip6: terms and cost no DNS lookup.
  3. Write one record — Start with v=spf1, add the ip4 and ip6 terms, then each include, and end with ~all. The SPF record generator writes this line for you and counts the lookups its own terms make.
  4. Publish it as one TXT record — In your DNS host's panel, add a TXT record at the domain itself, usually written as @, with the record as its value. If an SPF record is already there, edit that one instead of adding a second.
  5. Check it — Once the change is saved and the old record's time to live has passed, run your domain through the SPF checker. It follows every include, counts the lookups and shows the fix for anything that fails.

Each service’s setup page gives you its include, usually as a value that starts with include:. If a service instead hands you a whole v=spf1 record, do not publish it next to yours; take its include out and add it to your one record.

Most DNS hosts call the domain itself @, and some want the name left empty. Do not type your domain into the name field when the panel adds it for you, or the record lands at example.com.example.com and no receiver finds it. A record longer than 255 characters has to be stored as several strings in one TXT record; most DNS hosts split it for you, and receivers join the strings without adding spaces.

How do I check my SPF record?

You check an SPF record by reading the TXT records at your domain and following every include the way a receiver would. Type your domain into the SPF checker and it does both: it finds the record, parses each term, follows every include and redirect, and counts the DNS lookups against the limit of 10.

That is how to check your SPF record the way receivers do. The checker returns one row per question, each marked pass, warning, fail or unknown:

  • whether the domain publishes exactly one SPF record;
  • whether every term parses, and which terms do nothing (anything after all);
  • the lookup count, with the whole include tree;
  • void lookups, names that answer nothing, against their limit of 2;
  • whether every include and redirect target has one readable record;
  • how the record ends, and what that ending tells receivers;
  • whether it uses ptr, and whether the record is too large;
  • every IP range the record allows.

A failed row comes with the change to make. When the checker finds two SPF records, it prints the single merged record to publish instead.

In a terminal, dig shows the raw records. Every TXT record at the name comes back, and the SPF record is the one that starts with v=spf1:

dig +short TXT example.com
"site-verification=4f1c9a7e2b"
"v=spf1 include:_spf.mailhost.example ~all"

That shows the record but not what it includes, which is where most problems are. To see the result on real mail, send yourself a message and open its headers (in Gmail, Show original). The Authentication-Results line shows spf=pass or the reason it failed.

A change shows up once your DNS host has saved it and the old record’s time to live has run out, often an hour; DNS propagation explains the wait. The checker also keeps an answer for five minutes, so wait for both before you check again.

What do ~all, -all and ?all mean?

The all term at the end says what receivers should do with mail from any server your record does not list, and the symbol in front of it is the answer:

The four SPF endings
EndingResult for unlisted serversWhen to use it
~allsoftfail: accept the mail but treat it as suspiciousThe usual choice, and the safe start. Your DMARC policy decides what happens to mail that fails.
-allfail: the record asks receivers to reject itOnce you are sure every sender is listed, and always on a domain that sends no mail.
?allneutral: no statement either wayRarely. It protects your domain no more than having no record.
+allpass: every server on the internet passesNever. It lets anyone send as you and pass SPF.

Which to pick between the first two is a smaller choice than it looks. With DMARC in place, many receivers let your DMARC policy decide the fate of mail that fails SPF, but some reject on a -all fail before DMARC is consulted, and that can bounce mail from a sender you forgot to list. So start with ~all, read your DMARC reports until every sender passes, and only then consider -all.

Leaving the ending off is not neutral either: with no all term, unlisted servers get a neutral result, as if there were no record. The checker fails a record with no all term, or with +all, and warns on ?all.

Can a domain have two SPF records?

No. A domain may publish only one SPF record, and with two, receivers return a permanent error and SPF fails for every message from the domain, the mail of both services included. It usually happens when a new service’s setup page says “add this TXT record” and somebody adds a second v=spf1 line rather than editing the first:

example.com.  TXT  "v=spf1 include:_spf.mailhost.example ~all"
example.com.  TXT  "v=spf1 include:spf.newsletter.example -all"

The fix is to merge them: one v=spf1, every sender from both records once, and one ending. When the two endings differ, keep the softer one until you have checked every sender:

example.com.  TXT  "v=spf1 include:_spf.mailhost.example include:spf.newsletter.example ~all"

Publish the merged record, delete the other one, and run the SPF checker again. It prints this merged record for you when it finds two. Other TXT records at the same name, such as a site verification code, are not SPF records and can stay. A subdomain is a different name, so send.example.com can have its own SPF record beside the one at example.com.

What is the SPF 10-lookup limit?

The 10-lookup limit is the most DNS lookups a receiver will make while checking one SPF record; past it, SPF fails with a permanent error. Each include, a, mx, ptr and exists term counts, and so does a redirect, including every one inside the records you include. ip4, ip6 and all cost nothing.

A mail host’s include can cost several lookups on its own, because its record includes records of its own, so a domain with a handful of sending services can pass the limit without anyone noticing. The SPF checker draws the whole tree with its count. To get back under the limit, remove includes for services you no longer use, replace a and mx with the ip4 and ip6 ranges they stand for, or move one service’s mail to a subdomain with its own record. SPF PermError: too many DNS lookups goes through each of those fixes in detail.

Why does SPF pass but DMARC fail?

SPF passes but DMARC fails when the domain SPF checked is not the domain in your From address. SPF checks the return-path domain, and many sending services set the return path to a domain of their own, so their bounces come back to them. SPF then passes for their domain, and DMARC does not count it, because DMARC only counts an SPF pass whose domain matches the From domain. That match is called alignment.

Here is what that looks like in the headers of a delivered message:

Return-Path: <bounces+8812@mail.newsletter.example>
Authentication-Results: mx.receiver.example;
       spf=pass smtp.mailfrom=mail.newsletter.example;
       dkim=none;
       dmarc=fail header.from=example.com
From: Example Shop <news@example.com>

SPF passed for mail.newsletter.example, the From address says example.com, there is no DKIM signature to fall back on, and DMARC fails. There are two fixes, and doing both is best:

  • Align SPF. Set a custom return path at the service, a subdomain of yours such as send.example.com, so the domain SPF checks is under your From domain. Relaxed alignment, the default, accepts a subdomain. Custom return path walks through it.
  • Sign with DKIM. A DKIM signature with your domain passes DMARC on its own, whatever the return path says, and it survives forwarding, which SPF does not.

After the custom return path, the same message reads:

Return-Path: <bounces+8812@send.example.com>
Authentication-Results: mx.receiver.example;
       spf=pass smtp.mailfrom=send.example.com;
       dmarc=pass header.from=example.com

Forwarding is the other common cause. A forwarded message arrives from the forwarder’s server, which your record does not list, so SPF fails at the final receiver even though it passed at the first. DKIM is what carries DMARC through a forward. When you are ready to enforce DMARC, the guide to moving DMARC from none to reject covers the steps.

What are the most common SPF record problems?

The most common SPF record problems are a second record, too many lookups and a missing sender. Each one has a fix you can make in your DNS host’s panel in a few minutes:

Common SPF record problems and fixes
ProblemWhat receivers doFix
Two SPF recordsPermanent error: SPF fails for all mailMerge every sender into one record and delete the other
More than 10 DNS lookupsPermanent error: SPF fails for all mailRemove unused includes, or replace a and mx with IP ranges
No SPF recordResult none: no server is vouched forPublish one TXT record at the domain that starts with v=spf1
A sender is missingFail or softfail for that service's mailAdd the service's include, then watch your DMARC reports
Ends in +allPass for every server on the internetChange it to ~all
A typo such as inlcude: or ip4 192.0.2.1Permanent error: the whole record is ignoredCorrect the term; one bad term breaks the record
Terms after allNever readMove them before all, or remove them
Record at the wrong name, such as wwwResult none for the domain you send fromPublish it at the domain itself, @ in most panels

Run the SPF checker after every change; it reports each of these with the fix. If mail still lands in spam with a clean record, the cause is usually elsewhere, and why emails go to spam works through the rest.

Check yours

SPF checker

Is my SPF record valid, and is it under the 10-lookup limit?

Build an SPF record

Published Updated 13 min readBy the Rasket team

Written for beginners, small business owners and IT admins

Frequently asked questions

Where do I add an SPF record?

In the DNS panel of whoever hosts your domain's DNS, which is often the registrar you bought it from. Add a TXT record at the domain itself, written as @ in most panels, with the v=spf1 line as its value. A subdomain that sends mail needs its own record at that subdomain.

Is an SPF record a TXT record?

Yes. SPF once had its own DNS record type, but RFC 7208 retired it in 2014, and receivers now read only TXT records. An SPF record is a TXT record whose value starts with v=spf1, and every other TXT record at the same name is ignored by SPF.

Do I need an SPF record if I only receive email?

Yes, publish v=spf1 -all. It tells receivers that no server may send mail as your domain, so anyone forging your address fails SPF. The same record suits a parked domain, and a DMARC record at p=reject completes it for mail that claims the domain in the From address.

How long is an SPF record allowed to be?

One string in a TXT record holds 255 characters, so a longer record is stored as several strings, which receivers join without adding spaces. The standard also advises keeping all the TXT records at a name under 450 bytes in total, so some receivers can read the answer in one lookup.

Does SPF protect the From address people see?

No. SPF checks the return-path domain, the envelope sender bounces go to, which a reader never sees and a forger can set freely. DMARC ties SPF and DKIM to the From address, so SPF protects what people see only once a DMARC record is published and SPF is aligned.

Why does SPF fail when an email is forwarded?

The forwarded message arrives from the forwarding server, which your SPF record does not list, so the final receiver sees an unlisted server and SPF fails. A DKIM signature survives the forward because it travels inside the message, which is why DMARC can still pass on DKIM.

Should I use ~all or -all?

Start with ~all, which marks mail from servers you did not list as suspicious and leaves the decision to your DMARC policy. Move to -all once your DMARC reports show every legitimate sender passing, and use -all from the start on a domain that sends no mail at all.

Sources

  1. RFC 7208: Sender Policy Framework (SPF) for Authorizing Use of Domains in Email, Version 1 — IETF, read 2026-11-19
  2. RFC 9989: Domain-Based Message Authentication, Reporting, and Conformance (DMARC) — IETF, read 2026-11-19
  3. RFC 2606: Reserved Top Level DNS Names — IETF, read 2026-11-19
  4. Email sender guidelines — Google, read 2026-11-19
  5. Sender best practices — Yahoo, read 2026-11-19
  6. Outlook.com Postmaster: policies, practices and guidelines — Microsoft, read 2026-11-19
  • SPF — SPF is a TXT record listing which servers may send mail for a domain. A receiving server looks up the record for the return path domain and checks whether the…
  • DKIM, SPF and DMARC explained (2026 Full Guide) — What SPF, DKIM and DMARC each check, how to read the verdicts on a sent message, the records to publish, and what Gmail and Outlook.com require of senders.
  • Custom return path: why your bounces need it — What the return path is, how it differs from the From header, why a return path on your own subdomain makes SPF count toward DMARC, and the records it needs.
  • DMARC alignment — Alignment is the part of DMARC that asks whether the domain that passed authentication is the same one the reader sees. A DKIM signature or an SPF check can…
  • DMARC p=reject: move from p=none safely — Move DMARC from p=none to p=reject without losing mail: read aggregate reports, align every sender with DKIM, quarantine, then reject, and roll back fast.

Start sending this morning

Sign up, verify a domain and send your first email in minutes.