Skip to content
YHP DMARC

Knowledge base

SPF record syntax

Mechanisms, qualifiers and modifiers, with examples and the limits that trip people up.

An SPF record is a single TXT record on the domain used in the envelope sender. It starts with v=spf1 and is followed by terms that are evaluated left to right; the first match decides the result.

Mechanisms

MechanismMatchesDNS lookup
ip4:203.0.113.0/24An IPv4 address or rangeNo
ip6:2001:db8::/32An IPv6 address or rangeNo
a, a:host.example.comThe A/AAAA addresses of the domain or hostYes
mx, mx:example.comThe domain's mail serversYes
include:_spf.example.netAnything the other domain's SPF record allowsYes, plus its own
exists:%{i}.example.comIf a constructed name resolves (advanced)Yes
ptrReverse DNS. Deprecated; do not use.Yes
allEverything. Always last.No

Qualifiers

Each mechanism can have a prefix: + pass (the default), - fail, ~ softfail, ? neutral. In practice only the all at the end has a prefix: -all or ~all.

Modifiers

  • redirect=example.net uses another domain's record instead. Ignored if the record has an all.
  • exp= points to an explanation string. Rarely used.

Limits

  • 10 DNS lookups across the whole evaluation, including nested includes. More is a permanent error.
  • 2 void lookups (names that do not exist or have no records). More is a permanent error.
  • One record. Two v=spf1 records is a permanent error.
  • 255 characters per string. Longer records are split into several quoted strings in one TXT record; DNS hosts usually do this for you.

Check yours with the SPF surveyor.

See it on your own domain.

Check your DMARC, SPF and DKIM setup in seconds, then let us watch your reports for you.

Start free