Skip to content
Tech News
← Back to articles

SPF Record Syntax: Mechanisms, Qualifiers, Modifiers, and Macros

read original more articles
Why This Matters

Understanding SPF record syntax is crucial for email security and deliverability, as it defines how mail servers authenticate sender identities. Proper configuration helps prevent email spoofing and phishing attacks, safeguarding both organizations and consumers. This comprehensive reference ensures that developers and administrators can accurately implement and troubleshoot SPF records according to RFC 7208 standards.

Key Takeaways

22 min read Share

SPF Record Syntax: Mechanisms, Qualifiers, Modifiers, and Macros

SPF record syntax follows one shape: a single DNS TXT record that starts with v=spf1 , followed by space-separated terms — mechanisms with optional qualifiers, then modifiers — evaluated left to right until the first match. Here is a complete record:

v=spf1 ip4:192.0.2.0/24 include:_spf.example.com -all

That one line authorizes a /24 network and a third party’s servers, then fails everything else. Every rule governing it lives in RFC 7208, the SPF standard published in April 2014.

This page is the full reference: every mechanism, every qualifier, both modifiers, the complete macro table, evaluation order, DNS lookup limits, and record placement rules — each with the RFC 7208 section that defines it. If you want protocol fundamentals first — why SPF exists and how it fits with DKIM and DMARC — start with our SPF guide. If you build and maintain records, bookmark this.

SPF Record Syntax at a Glance

An SPF record is one string of text in the RDATA of a single TXT record, and its grammar has exactly three kinds of parts: a version tag, mechanisms (each with an optional qualifier), and modifiers. The version tag must be exactly v=spf1 — a record starting v=spf10 is discarded, not partially matched (§4.5).

Every SPF record is the same three kinds of parts: a version tag, mechanisms with optional qualifiers, and modifiers.

The grammar in brief, from §3 and §4.6.1:

... continue reading