DNS TXT SPF record: what it is and how it works

An SPF policy is published in DNS as a TXT record, not as its own DNS record type. RFC 7208 requires that SPF data appear only in a TXT (type 16) resource record whose text begins with the tag v=spf1. A dedicated SPF record type existed under an earlier RFC, but current implementations don't use it. To find out whether a domain has SPF, a receiver queries DNS for TXT records at that domain and looks for one that matches the tag.
At a glance
Quick takeaways
- SPF policy content MUST be published in a DNS TXT (type 16) record; a separate SPF record type exists in DNS history but isn't used by current implementations.
- Every valid SPF record starts with the version tag
v=spf1, immediately followed by a space or the end of the record. - A domain must not have more than one TXT record matching that tag. If a receiver finds more than one, the check returns
permerrorinstead of picking one. - If no TXT record at the domain begins with
v=spf1, the standards-defined result isnone, the formal meaning of "this domain has no SPF record." - A TXT record's value can span several internal strings of up to 255 octets each; SPF treats those strings as one record concatenated together.
- SPF records should stay small enough that the full DNS answer fits inside a 512-octet response.
How an SPF policy lives inside a DNS TXT record
A TXT record is a general-purpose DNS record. RFC 1035 defines its RDATA as "one or more s," and its meaning depends entirely on which domain the record is attached to. Nothing about the TXT record type itself relates to email; a domain can carry TXT records for many unrelated purposes. For the general record shape, see what a TXT record is.
SPF narrows that general container to one specific use. RFC 7208 states that SPF records "MUST be published as a DNS TXT (type 16) Resource Record (RR) only," with the record's content encoded as US-ASCII. An earlier RFC had defined a dedicated DNS record type for SPF, code 99. RFC 7208 reports that this type "saw no substantial use, and interoperability issues in a common DNS server made its future application questionable at best," and current implementations are not to use it. That history is why every current SPF policy is a TXT record and nothing else.
SPF sits alongside other authentication mechanisms, including DKIM and DMARC, inside the broader email authentication picture. The full grammar an SPF record uses to authorize senders lives on the SPF hub.
When the record's exact content changes the result
A record only counts as SPF if its text begins with the exact tag v=spf1, immediately followed by a space or the end of the record. RFC 7208 states the version section "ends at the space character... or the end of the record," so a record starting with something like v=spf10 does not match and is discarded.
When a receiver checks a domain, it queries DNS for TXT records only. Two outcomes follow directly from what DNS returns:
- If no TXT record at the domain begins with
v=spf1, the result isnone. That is the standards-level meaning of "this domain has no SPF record." - If more than one TXT record at the domain matches, the domain is out of compliance. RFC 7208 requires that a domain "MUST NOT have multiple records that would cause an authorization check to select more than one record." When a receiver still finds several matching records, the check returns
permerrorrather than guessing which one is authoritative.

Size matters too, though less strictly. A TXT record's RDATA can hold more than one internal character-string, each capped at 255 octets by the DNS wire format in RFC 1035. RFC 7208 says a record with multiple strings "MUST be treated as if those strings are concatenated together without adding spaces," which is how a policy longer than 255 octets fits inside one TXT record. RFC 7208 also recommends the record stay small enough that the full DNS answer fits inside a 512-octet response, using a combined name-and-record length under 450 octets as the practical guideline for UDP.
If a check keeps returning permerror for a different reason, specifically too many nested DNS lookups rather than duplicate records, that failure mode has its own fix; see how to fix SPF PermError: too many DNS lookups.
A worked SPF TXT record
RFC 7208 gives this as an example of a correctly formed SPF record:
v=spf1 +mx a:colo.example.com/28 -allThis is the standards body's own illustrative example, not a live production value, and it should not be copied onto a real domain. Two things about its shape apply to any SPF TXT record, regardless of which mechanisms it uses:
- The record starts with
v=spf1, and nothing precedes it. - Everything after the version tag is one continuous string, even when the underlying TXT record stores it as several concatenated character-strings on the wire.
What to check before you publish or troubleshoot a record
If a domain doesn't yet have a matching record, three requirements come directly from the RFCs above, independent of which DNS provider hosts the zone:
- Publish the value as a TXT (type 16) record, not any other record type.
- Make sure the record's text begins with
v=spf1, with nothing before it. - Confirm the domain ends up with exactly one TXT record matching that tag. A second matching record, even one added by a different team or a forgotten legacy entry, produces
permerrorrather than a working policy.
Check whether your domain publishes an SPF record
Run the domain through Palisade's SPF checker to see the same DNS TXT lookup described above applied to your own domain, instead of working it out by hand against a DNS provider's interface.
A DNS TXT lookup only confirms what's published. It doesn't confirm that a specific sending source is included in the record, that DKIM or DMARC are configured correctly alongside it, or that a receiving mail server will treat a given message as authenticated.
Evidence
Sources and further reading
Questions readers ask
Frequently asked questions


Written by
Samuel ChenardCEO & Co-Founder, Palisade
Samuel Chenard is the CEO and co-founder of Palisade, AI-first DMARC software for IT teams and MSPs, from one domain to thousands.
More from Samuel →


