SPF Record Generator
List the servers and services authorized to send email using your domain. Generate a syntactically valid SPF TXT record and copy it straight into your DNS.
English
What is an SPF record?
SPF (Sender Policy Framework) is a DNS TXT record that lists every server and service authorized to send email using your domain. When a receiving mail server gets a message claiming to come from your domain, it looks up your SPF record and checks whether the sending IP is on your approved list. If not, the policy in your record tells the receiver what to do with the message.
A minimal SPF record looks like this:
v=spf1 include:_spf.google.com ~all
Three things define what it does:
- The version (
v=spf1), which is required and always first. - One or more mechanisms (
include,ip4,ip6,a,mx,exists) that list authorized sources. - An
allqualifier (~all,-all,?all) at the end that tells receivers what to do with everything else.
SPF gives receivers a definitive answer about which IPs may send mail using your domain. Pair it with DKIM and DMARC for a full sender-authentication setup.
How to create an SPF record
This generator builds your record in three steps:
-
Enter your sending domain
This is the apex domain you send email from, for example
yourdomain.com. SPF goes at the apex, not at a subdomain. -
List your authorized sending sources
For most teams, this is one or more
includereferences to your email service providers (Google Workspace, Microsoft 365, SendGrid, Mailgun) plus any IP addresses you send from directly. Use the quick-add chips for common ESPs. -
Pick the all qualifier
Start with
~all(SoftFail) when you first publish so unmatched senders land in spam rather than getting rejected. Move to-all(Fail) once you have confirmed every legitimate sender is covered.
Click Generate SPF record to build the TXT entry, then copy it into your DNS.
How to publish your SPF record
You publish SPF as a TXT record at the apex of your domain. The hostname is the domain itself, not a subdomain. Steps vary slightly per DNS provider, but the shape is the same:
Sign in to your DNS provider and open the DNS settings for your domain.
Add a new record. Set the type to
TXT.Set the host or name field to
@, or leave it blank. Most providers accept either to mean the apex.Paste the generated record into the value or content field.
Save. DNS propagation typically completes within a few minutes.
If your domain already has an SPF record, edit it instead of adding a new one. A domain may publish only one SPF record. Two records cause every receiver to return a permanent error and SPF fails for all your mail.
SPF mechanisms and qualifiers
| Mechanism | Matches | Example |
|---|---|---|
all | Everything. Always last in the record, prefixed with a qualifier. | ~all |
ip4 | An IPv4 address or CIDR range. | ip4:192.0.2.1 |
ip6 | An IPv6 address or CIDR range. | ip6:2001:db8::1 |
a | The A or AAAA record of the domain (or an alternate domain). | a or a:mail.example.com |
mx | The MX record of the domain. | mx or mx:example.com |
include | Another domain's SPF record. Adds its authorized senders to yours. | include:_spf.google.com |
exists | Whether an A record exists at a computed domain. Used for whitelist and geo checks. | exists:%{i}.spf.example.com |
redirect | Modifier. Replaces this record entirely with the SPF record at the named domain. | redirect=spf.example.com |
ptr | Reverse-DNS lookup. Deprecated and discouraged by RFC 7208 because of cost and unreliability. | Not recommended. |
| Qualifier | Symbol | Meaning |
|---|---|---|
| Pass | + (default) | The source is authorized. Default if no qualifier is given. |
| Fail | - | The source is not authorized. Receivers reject the message. |
| SoftFail | ~ | The source is not authorized but receivers should be lenient. Often delivered to spam. Recommended while you are confirming your sender list. |
| Neutral | ? | No assertion. Treated the same as having no SPF policy on unauthorized sources. |
Frequently asked questions
What is an SPF record generator?
An SPF record generator builds the TXT entry you publish in DNS to declare which servers can send email using your domain. You list your sending sources (email providers, transactional services, and any IP addresses you send from directly), pick how strict the policy should be, and the generator outputs a syntactically valid record you can paste straight into your DNS provider.
How to implement an SPF record for your domain?
Three things have to happen. First, identify every legitimate sender. This includes your mail provider (Google Workspace, Microsoft 365), transactional services (SendGrid, Mailgun, Postmark), marketing platforms (Mailchimp, Klaviyo), and any servers you send from directly. Second, generate your record with this tool covering all those sources. Third, publish it as a TXT entry at your domain's apex, then start with ~all and tighten to -all after a few weeks of clean reports.
What's the SPF record format?
An SPF record is a single TXT string starting with v=spf1, followed by space-separated mechanisms, ending with an all qualifier. A working example: v=spf1 ip4:192.0.2.1 include:_spf.google.com include:mailgun.org ~all. Each mechanism describes one authorized sending source. The all qualifier at the end tells receivers what to do with senders that do not match any earlier mechanism.
What is the difference between -all, ~all, ?all, and +all?
The qualifier on all controls how receivers treat unauthorized sources. -all (Fail) means reject the message. ~all (SoftFail) means accept but mark as suspicious. ?all (Neutral) means no assertion, treated the same as having no policy on those senders. +all (Pass) authorizes everyone, which makes SPF useless and should never be published. Best practice is to start with ~all while you confirm your sender list, then move to -all once you are confident.
How do I avoid the SPF 10 DNS lookup limit?
SPF allows a maximum of 10 DNS lookups during evaluation. Each include, a, mx, exists, redirect, and the deprecated ptr mechanism counts as a lookup, and each include adds the lookups inside the included record on top of that. Exceeding the limit returns permerror, which fails SPF for every message. To stay under the cap, audit your record for unused includes, replace nested includes with flattened IP lists where practical, and consider an SPF flattening service if your sender stack genuinely needs more than 10 lookups.
Can I have more than one SPF record per domain?
No. A domain may publish only one SPF record. Two or more cause every receiver to return permerror and SPF fails for all of your mail. To add a new sender, edit your existing record and append a new include or ip4 mechanism. Subdomains can have their own separate records, but the apex domain itself is limited to one.