SPF Record Syntax Cheatsheet (RFC 7208)

Every SPF qualifier, mechanism, modifier, and DNS lookup cost summarized on one page — plus a live interactive parser.

RFC 7208Max 10 Lookups~all vs -all

Copy-Ready DNS Records & Configuration

Host / NameTypeValueTTLPurpose
ip4:<cidr> 0 Lookups ip4:192.0.2.0/24 Zero Matches IPv4 address or CIDR block with zero DNS cost
ip6:<cidr> 0 Lookups ip6:2001:db8::/32 Zero Matches IPv6 address or CIDR block with zero DNS cost
include:<domain> 1+ Lookups include:_spf.google.com 1 + nested Recursively evaluates another domain's SPF record
a / mx 1 Lookup a / mx:mail.example.com 1 each Queries A/AAAA or MX records; avoid unless your web/MX server sends mail
~all / -all 0 Lookups ~all (SoftFail) / -all (HardFail) Zero Terminal catch-all mechanism; NEVER use +all

Interactive SPF 10-DNS-Lookup Limit Checker

MechanismTypeDirectEst. TotalNotes

Step-by-Step Deployment Checklist

  1. Always start with `v=spf1` (lowercase) and keep **exactly one** SPF TXT record per hostname.
  2. Place zero-lookup `ip4:` / `ip6:` mechanisms before `include:` mechanisms so receivers short-circuit early.
  3. End with `~all` (recommended alongside DMARC) or `-all` (strict HardFail). Never publish `+all`.
  4. Run every edit through our interactive SPF 10-DNS-Lookup Checker before updating production DNS.

Common Pitfalls to Avoid

Chrome Extension — Page2MCP + Gumroad

Turn Docs & DNS Dashboards into Structured Context for Your AI Coding Agents

Capture clean Markdown and MCP-ready context with our Page2MCP Chrome Extension and AI Agent Production Workflow Kit on Gumroad.

Frequently Asked Questions

What is the difference between ~all and -all in SPF?

`~all` (SoftFail) marks unauthorized mail as suspicious without immediately bouncing forwarded mail, whereas `-all` (HardFail) instructs strict receivers to reject unauthorized mail outright.

Can I have two SPF records on the same domain?

No. Multiple `v=spf1` TXT records on the same hostname cause an instant `PermError`. Merge them into one record: `v=spf1 include:a.com include:b.com ~all`.

Do ip4 and ip6 count toward the 10 DNS lookup limit?

No! Only `include`, `a`, `mx`, `ptr`, `exists`, and `redirect` count toward the 10-DNS-lookup limit.

Related DNS & Email Auth Guides