SPF Record Syntax: Mechanisms, Qualifiers, Modifiers and Common Errors

November 20, 2026 # SPF & DKIM
Share this insight:
SPF Record Syntax: Mechanisms, Qualifiers, Modifiers and Common Errors

An SPF record is one DNS TXT record at your domain that starts with v=spf1, followed by mechanisms that say which servers may send mail for the domain, each with an optional qualifier, and optionally the modifiers redirect= and exp=, once each. Spaces separate the terms:

v=spf1 include:_spf.google.com ip4:192.0.2.10 -all

The syntax is strict. A receiver checks the whole record before it evaluates any of it, and a syntax error anywhere returns permerror for every sender, including the ones listed correctly (RFC 7208 §4.6). In our October 2026 scan of the Tranco top 100,000, 355 of the 71,117 domains with SPF had such an error, nearly half of them a misspelled mechanism name or a misplaced space. Some typos are quieter: include= instead of include: isn't an error at all, receivers just skip the term, so it no longer authorizes the sender it was meant for.

TL;DR

  • Format: v=spf1, then mechanisms (include, a, mx, ip4, ip6, exists, all, and the deprecated ptr), then modifiers, separated by spaces. One record per name.
  • Order matters for evaluation, not for syntax. Receivers test mechanisms left to right and stop at the first match. Nothing after all is evaluated, but it's still syntax-checked.
  • Two kinds of typo. A wrong mechanism name (ipv4:, includes:) breaks the whole record. A colon written as = (ip4=, include=) turns the term into an unknown modifier that receivers ignore, so only that term stops working.
  • Receivers don't all follow the standard. In our 21-provider test, Outlook.com passed a record with ipv4: as if it said ip4:, and Google's DMARC reports called both syntax errors fail, not permerror.

An SPF record, term by term

 
Here's the example above, one term at a time:

TermTypeWhat it does
v=spf1VersionMarks the TXT record as SPF. It must come first
include:_spf.google.comMechanismMatches if Google's own SPF record passes the sending IP
ip4:192.0.2.10MechanismMatches mail from this one address
-allMechanism with the - qualifierMatches everything else, with the result fail

A receiver checks the record of the domain in the envelope sender, the MAIL FROM address, which can differ from the From address people see. It may check the HELO name the same way, as a separate identity (§2.3, §2.4). It tests the mechanisms from left to right and stops at the first one that matches. The qualifier of that mechanism is the result (§4.6.2). If nothing matches and there's no redirect=, the result is neutral, as if the record ended in ?all (§4.7).

The record goes in a TXT record at the exact name it covers. A subdomain that sends mail needs its own record, and the dedicated "SPF" record type that some DNS panels still offer was discontinued in 2014: receivers only read TXT (§3.1).

SPF mechanisms

 

MechanismMatches whenCounts toward 10Example
allAlways0-all
include:<domain>That domain's record passes the IP1 plus its owninclude:_spf.google.com
a[:<domain>]The IP is an A or AAAA address of the domain1a:mail.example.com
mx[:<domain>]The IP belongs to one of the domain's MX hosts1mx
ip4:<address>[/prefix]The IP is in this IPv4 range0ip4:192.0.2.0/24
ip6:<address>[/prefix]The IP is in this IPv6 range0ip6:2001:db8::/32
exists:<domain>The name has an A record1exists:%{i}._spf.example.com
ptr[:<domain>]The IP's reverse name is under the domain and resolves back to the IP1Don't use it (§5.5)

Without a domain, a, mx and ptr use the domain being checked. a and mx also take prefix lengths to cover the network around each address: a/24 sets the IPv4 prefix, a//64 the IPv6 one, a/24//64 both. exists: names are usually built with macros, such as %{i} for the sending IP.

The third column matters because a record may cause at most 10 DNS-querying terms per evaluation, nested includes counted, before the result becomes permerror (§4.6.4). It counts terms against that limit, not DNS queries: an mx or ptr term can send several queries and still counts once. ip4, ip6 and all are free. Here's how to count them and cut back.

include is the one people misread. It doesn't paste the other record into yours: it asks whether that record gives pass. A fail or softfail inside the included record just means "no match here", and evaluation moves on to your next term (§5.2). If the included domain has no SPF record at all, the result is permerror, so the name has to be exact.

These are the includes the top 100,000 use most, from our census:

IncludeDomains using itLookups it costs
_spf.google.com18,0811
spf.protection.outlook.com16,4101
amazonses.com7,4911
mail.zendesk.com5,0741
sendgrid.net4,2232

The cost counts the include itself plus everything it pulls in, as published on the scan day, October 2026.

SPF qualifiers

 
A qualifier is the one character in front of a mechanism that sets the result when it matches:

QualifierResultTypical useTop 100k records ending this way
+ (the default)passEvery mechanism that lists a sender, written without the +35 (+all)
-fail-all: everything not listed is unauthorized31,704 (45.1%)
~softfail~all: not listed, probably unauthorized35,213 (50.1%)
?neutral?all: no statement, used while testing1,489 (2.1%)

Out of 70,338 domains with a single SPF record. Another 1,897 (2.7%) have no all term: 1,587 of them end in redirect=, and the other 310 leave a sender no mechanism matches at neutral.

Qualifiers work on any mechanism, but in practice they sit on all. +all authorizes every server on the internet, which makes the record pointless: 35 of the top 100,000 publish it. With DMARC, -all and ~all both deny the aligned SPF pass DMARC needs, so the difference is smaller than it looks. We compared the two here.

SPF modifiers: redirect= and exp=

 
Modifiers are name=value pairs. They don't match anything themselves.

  • redirect=<domain> applies only when no mechanism has matched. It hands the evaluation to another domain's record, and that record's result, fail or softfail included, becomes yours (§6.1). It's ignored whenever the record has an all term anywhere (§5.1), and it costs one lookup.
  • exp=<domain> points to a TXT record with an explanation that a receiver may quote when it rejects a message for fail (§6.2). Few domains use it, and it doesn't count toward the 10 lookups.
  • Each may appear once. A second redirect= or exp= is a permerror (§6). The standard asks for them at the end of the record, after the mechanisms, but that's a recommendation, not a syntax rule.
  • Any other syntactically valid name=value is an unknown modifier, and receivers must ignore it "no matter where, or how often" it appears (§6). That rule is why include= doesn't break a record, and also why it does nothing. The value still has to be valid: foo=% is a syntax error.

redirect= vs include:

 

Pointinclude:redirect=
When it runsIn its place, left to rightAfter every mechanism failed to match
What it takes from the other recordOnly a passThe whole result
The other record's allEnds nothing in yoursBecomes your result
With an all in your recordWorks as usualIgnored
Built forA provider that sends for youSeveral domains you run with one policy

redirect= is for a group of your own domains that should share one record:

example.org. TXT "v=spf1 redirect=_spf.example.com" example.net. TXT "v=spf1 redirect=_spf.example.com" _spf.example.com. TXT "v=spf1 include:_spf.google.com ip4:192.0.2.10 -all"

Change _spf.example.com and all three domains follow. For a provider's servers, use include:. A redirect to a domain you don't control also hands over your policy, and the standard warns that the other domain's record may not work for your addresses (§6.1).

The common mistake is a redirect with an all next to it, such as v=spf1 redirect=_spf.example.com ~all. The ~all wins, the redirect never runs, and every sender gets softfail. Write either v=spf1 redirect=_spf.example.com or v=spf1 include:_spf.example.com ~all.

SPF record examples

 

SetupRecord
Google Workspace onlyv=spf1 include:_spf.google.com ~all
Microsoft 365 onlyv=spf1 include:spf.protection.outlook.com -all
Both, plus your own serverv=spf1 include:_spf.google.com include:spf.protection.outlook.com ip4:192.0.2.10 -all
A domain that sends no mailv=spf1 -all
Several domains sharing one policyv=spf1 redirect=_spf.example.com

The first two are what Google and Microsoft give in their setup guides, with each vendor's choice of ~all or -all. 192.0.2.10 stands for your own address.

A domain that sends no mail at all is worth a record too: v=spf1 -all tells receivers that any message from it is forged. In the census, 2,591 domains without MX records publish exactly that. Every additional sender, such as a newsletter platform or a help desk, adds its include to the one record. Adding a second v=spf1 record instead makes SPF fail for everyone; here's how to merge two records.

SPF format rules that catch people out

  • It starts with exactly v=spf1. Followed by a space or the end of the record (§4.5). v=spf10, v=spf2.0/pra (the retired Sender ID) and a record with a space in front of v=spf1 aren't SPF records, so the domain has none. So is one pasted from a word processor with curly quotes, “v=spf1 -all”: the quote mark becomes the record's first character.
  • Spaces separate terms, and nothing else does. Extra spaces are fine. A tab or a line break inside the record is a syntax error. A comma or a semicolon isn't a separator either: ip4:192.0.2.10,ip4:192.0.2.11 is an invalid address, and include:_spf.google.com,include:servers.mcsv.net is one long name that doesn't exist, so the lookup fails.
  • Case doesn't matter. V=SPF1 IP4:192.0.2.10 -ALL is valid: mechanism and modifier names are case-insensitive (§4.6.1).
  • A domain name needs a dot. a:mail is a syntax error. Write the full name, a:mail.example.com. An IP address isn't a domain name either: a:192.0.2.10 is an error, ip4:192.0.2.10 is right.
  • IP addresses are written in full. ip4: takes four numbers and an optional prefix from /0 to /32, ip6: takes an IPv6 address and up to /128. ip4:192.0.2 is an error, ip4:192.0.2.0/24 is the range you meant (§5.6).
  • Long records are split into strings, and the strings join without spaces. A TXT string holds at most 255 characters, so DNS panels split longer records, and receivers join the parts exactly as they are (§3.3). See the example below the list.
  • Keep the whole answer small. The standard asks for SPF answers that fit in 512 bytes, which leaves roughly 450 for the name and all TXT records at it (§3.4). Larger answers can fail where DNS over TCP is blocked.
  • Macros have their own syntax. %{i}, %{d} and the other macro letters let a record build names from the message, mostly in exists:. 2,844 single records in the census use them. A wrong letter, such as %{z}, is a syntax error.

In a split record, the space between two terms has to stay inside one of the strings:

"v=spf1 include:_spf.google.com " "include:servers.mcsv.net ~all"

Without that trailing space, the record reads include:_spf.google.cominclude:servers.mcsv.net. That's still valid syntax, so a check of the syntax alone passes it, but it's a lookup for a name that doesn't exist, and a permerror for every sender that reaches it.

A trailing dot after a domain name, as in include:spf.protection.outlook.com., is allowed by the standard (§7.1), and parsers accept it. Microsoft's setup guide still lists it as a mistake, so leaving it off costs nothing.

Common SPF syntax errors

 
These break the whole record. Every sender gets permerror, the correct terms included:

WrittenShould beWhat's wrong
ipv4:192.0.2.10ip4:192.0.2.10Unknown mechanism
includes:_spf.google.cominclude:_spf.google.comUnknown mechanism
include: _spf.google.cominclude:_spf.google.comEmpty include, then a name with no mechanism
redirect:_spf.example.comredirect=_spf.example.comA modifier needs =
a:192.0.2.10ip4:192.0.2.10An IP where a domain belongs
a:maila:mail.example.comNo dot in the domain
ip4:192.0.2ip4:192.0.2.0/24Incomplete address
ip4:192.0.2.0/33ip4:192.0.2.0/24Prefix over 32
ip4:2001:db8::1ip6:2001:db8::1IPv6 address in ip4:
ip4:192.0.2.10,ip4:192.0.2.11ip4:192.0.2.10 ip4:192.0.2.11Comma as a separator
--all, all:example.com-allTwo qualifiers, all with a value
Two redirect=OneDuplicate modifier

These are valid syntax, so receivers carry on, but the term does nothing:

WrittenShould beWhat happens
ip4=192.0.2.10ip4:192.0.2.10Unknown modifier, ignored: doesn't authorize the address
include=_spf.google.cominclude:_spf.google.comUnknown modifier, ignored: doesn't authorize Google's servers
-all include:servers.mcsv.netinclude:servers.mcsv.net -allTerms after all are never evaluated (§5.1)
redirect=_spf.example.com ~allEither oneThe all wins, the redirect is ignored
~all v=spf1 include:…One v=spf1, one all at the endTwo records pasted into one: the second half never runs

A term after all is never evaluated, but it's still checked: v=spf1 -all ipv4:192.0.2.10 is a permerror, not a harmless leftover.

Microsoft's guide also lists include= as a syntax error. In our test, Outlook.com's aggregate report labeled our include= record permerror, while every other reporter labeled it fail, which is what the standard gives.

What the top 100,000 domains got wrong

 
We took the 355 records that failed the syntax check in our census and ran each one through the parser behind our SPF Checker. The table counts each domain once, by the first error the parser found. 98 of the records have more than one. The counts are on GitHub, and the numbers in the two paragraphs below the table are in a second file.

What went wrongExampleDomains
Wrong mechanism nameipv4:192.0.2.10, ip:192.0.2.1087
Space inside a termip4: 192.0.2.1048
Another TXT value~allgoogle-site-verification=…47
No space between termsip4:192.0.2.10~all35
Not a domain namea:192.0.2.10, a:mail27
Wrong characterNon-breaking space, line break27
Stray text-all;, ~all., -all info25
No mechanism name192.0.2.10, _spf.google.com23
Empty valuev=spf1 a mx ip4: ~all21
Broken IP addressip4:192.0.2, ip4:mail.example.com13
Broken macroexists:%.spf.example.com2
Total355

A wrong mechanism name is the most common error: 40 of the 87 records use ipv4:, the typo from our test below, and 20 shorten it to ip. Spaces cause 83 more. A space after the colon (ip4: 192.0.2.10, 40 records) leaves an empty mechanism followed by an address with no mechanism in front of it. A missing space runs two terms together: 17 records end in something like include:_spf.google.com~all.

Of the 47 records with another TXT value inside, 26 carry a Google site-verification token, and in 34 the pasted value follows all with no space. One way that happens is saving the SPF record and the token as two strings of the same TXT record, since strings are joined without a space (§3.3). Invisible characters are the hardest to spot in a DNS panel: 13 records contain a non-breaking space, and 11 a line break or a tab. Eight domains publish nothing but a, mx and an empty ip4: (v=spf1 a mx ip4: ~all), which looks like a template whose address was never filled in.

What receivers did with typos in our test

 
In our test of 21 mailbox providers, four of the records had typos: ip4= and ipv4: sent from our own server, include= and includes: sent through Mailgun. The domain had DMARC p=reject and the messages had no aligned DKIM signature, so SPF was all they had.

  • The big receivers refused both include typos. Through Mailgun, Gmail, Yahoo, Apple and Outlook.com refused include= and includes: with DMARC replies, while the clean control was delivered. From our own server, Gmail refused ip4= and ipv4: the same way. Yahoo and Apple refused those messages too, but their replies cited our sending IP and hit the clean control as well, so they say nothing about the typos.
  • Outlook.com passed ipv4:. Its own DMARC report gives spf=pass for that record, and the mistyped term was the only one that could match our address. That is consistent with reading ipv4: as ip4:, although a report doesn't show the receiver's parser. It refused includes: with its usual 550 5.7.509, so it isn't lenient about typos in general.
  • Reports name a syntax error four ways. For the ipv4: record, Google reported fail, Mail.ru none, Seznam permerror and Outlook.com pass. Google also reported includes: as fail. If you look for permerror in your DMARC reports, you won't find a syntax error that Google saw.
  • A few receivers told the typos apart at SMTP. Interia refused the include= record, which gives fail, and kept deferring the includes: one as "SPF with invalid content".

A receiver that lets a broken record through today isn't a reason to keep it. The study has every receiver's result for each typo and the bounce text each one sends.

How to check your record's syntax

 
Paste the domain into the DMARKOFF SPF Checker. It reads the published record, checks every term against RFC 7208 and points at the character where the syntax breaks. For one of our test domains, whose record says includes:_spf.mailgun.org, it answers:

Checker output: Syntax error at character 8 in "includes:_spf.mailgun.org": unknown mechanism "includes" (did you mean include:_spf.mailgun.org?). The whole record is a permerror: receivers evaluate none of its terms

For include=, it reports a term receivers ignore rather than an error, because that's what the standard makes of it.

DMARKOFF's SPF Checker on a record that misspells include as includes: the term is flagged as a syntax error at character 8, lookups show n/a (permerror), and the message says receivers evaluate none of the record's terms

The SPF Checker on one of our test domains. One wrong letter in a mechanism name stops the whole record, so the -all below it is never evaluated either.

To read the raw record yourself:

dig +short TXT example.com

Each line of the answer is one TXT record:

"v=spf1 include:_spf.google.com " "include:servers.mcsv.net ~all" "google-site-verification=example-token"

Quoted strings on the same line are parts of one record and join without added spaces, so check where the spaces fall between them. The quotes only mark the strings; they aren't part of the record. Other lines are separate records: a verification token like the one above stays in its own record and never goes into SPF. After you fix the record, the old one can stay in resolvers' caches until its TTL, as set in your DNS panel, runs out. Recheck once that time has passed, then watch the next days of DMARC reports for the senders that failed.
 

Check your SPF record

 

FAQ

v=spf1, then the mechanisms that list your senders, then usually an all term, separated by spaces, in one TXT record at the domain. For example: v=spf1 include:_spf.google.com ip4:192.0.2.10 -all.

No. Mechanism and modifier names are case-insensitive, so V=SPF1 IP4:192.0.2.10 -ALL is as valid as the lowercase form.

Yes. List each sender as its own include: in the same record. The limit is 10 DNS-querying terms per evaluation, counting the includes a receiver reaches and the terms inside them, not a number of includes.

No. RFC 7208 recommends putting it last, but a record with redirect= elsewhere is still valid. What matters is that the record has no all term, or the redirect is ignored.

Not for the syntax. It matters for evaluation: receivers stop at the first match, so a sender listed before a broken include, or before an 11th term that needs a DNS lookup, still passes. An ip4: after ten such terms can still match, because it needs no lookup. A syntax error breaks the record wherever it is.

Each TXT string holds 255 characters, and a record can span several strings joined without spaces. The standard asks that the whole DNS answer stay under 512 bytes, and an evaluation use at most 10 DNS-querying terms.

Aliaksandr Markau
Aliaksandr Markau Co-founder & CTO

Co-founder & CTO at DMARKOFF and GlockApps, email security specialist with 20+ years of experience, Golang & ClickHouse expert. A happy father of two teenagers.

Related Posts