SPF Record Generator
Build a valid Sender Policy Framework (SPF) TXT record for your domain. Pick which mail providers can send for you, add specific IPs if needed, choose how strictly to enforce, and copy the assembled record.
Last reviewed: June 2026
example.com, not mail.example.com). Only one SPF record is allowed per domain — if you already have one, replace it; don't add a second.How does an SPF record actually work?
SPF (Sender Policy Framework) is a published list of who's allowed to send email from your domain. When a receiving mail server gets a message claiming to be from @example.com, it looks up the SPF TXT record for example.com and checks whether the connecting IP is in the list. If it isn't, the receiver applies whatever enforcement the record specifies — soft fail, hard fail, or neutral.
An SPF record always starts with v=spf1 and is a single space-separated string of mechanisms followed by an "all" qualifier at the end. The mechanisms are the things that authorise sending — a, mx, include:, ip4:, ip6: — and the qualifier is what to do with everyone else.
Should I start with -all or ~all?
Start with ~all. Soft fail tells receivers "this sender wasn't authorised, but maybe accept it anyway and treat it as suspicious." That's the right default while you're still discovering which third parties send email on your behalf — you'll see them in DMARC aggregate reports and can add them to the record before any legitimate mail breaks.
Once you've watched the reports for a few weeks and confirmed that every legitimate sender is in your record, tighten to -all. Hard fail tells receivers to reject anything not on the list, which is what you ultimately want.
The 10 DNS lookup gotcha
The SPF spec caps the number of DNS lookups a receiver will do while evaluating your record at 10. Every include:, a, mx, exists:, and redirect= mechanism counts. (Plain ip4: and ip6: don't.) Go over and receivers treat your record as permerror, which most reject.
It's easier to hit than you'd think — including Google Workspace, Microsoft 365, SendGrid, and Mailgun together is already 4 of your 10. If you cross the limit, the standard fix is "flattening" — replacing some include: mechanisms with the IPs they expand to, refreshed periodically. Our SPF checker shows the current lookup count for any domain.
Where does this go?
Publish the assembled record as a TXT record on your DNS provider, at the apex of the domain (just example.com). The record value is the literal string the generator outputs — most DNS providers will wrap it in quotes for you automatically. After publishing, give DNS a few minutes to settle, then verify with the SPF Checker.
Last reviewed by Network Lookup Team, June 2026.