SPF Record Generator

Pick the servers and services that send email for your domain and get an SPF record ready to paste in your DNS.

Current SPF record of gmail.com loaded. Change what you need below. v=spf1 redirect=_spf.google.com
Your own servers
Email services that send for you

The number is the DNS lookups each service uses, including its nested includes.

Email from any other server

Your SPF record



            
Type
TXT
Name / host
@ (gmail.com)
DNS lookups

Publish it as a single TXT record: a domain must have only one SPF record. Replace the old one instead of adding a second. Check it with the SPF Checker after publishing →

What is an SPF record?

SPF (Sender Policy Framework) is a TXT record in your DNS that lists the servers allowed to send email for your domain. When a message arrives, the receiving server checks whether the server that sent it is on the list. Together with DKIM and DMARC it stops others from sending email that pretends to come from you, and it helps your own email reach the inbox.

How to use the generator

  1. Optional: enter your domain and press Load to start from your current record.
  2. Tick the services that send email for you: your mailbox provider (Google Workspace, Microsoft 365…), newsletter tools, your shop or help desk.
  3. Add the IP addresses of your own servers, if any.
  4. Choose what to do with email from other servers. ~all is the usual choice.
  5. Copy the record and publish it as a TXT record on your domain (name @), replacing any old SPF record.

Parts of an SPF record

PartMeaningDNS lookups
v=spf1Always first: marks the record as SPF.0
ip4:203.0.113.10An IPv4 address or network (/24) that may send.0
ip6:2001:db8::/32The same for IPv6.0
mxThe servers in your MX records may send.1
aThe server your domain points to may send.1
include:_spf.google.comEverything allowed by another domain's SPF (a provider).1 + nested
~all / -allAlways last: what to do with every other server (softfail / fail).0

The 10-lookup limit

To check SPF, receivers may make at most 10 DNS lookups. Each include, mx and a uses one, and the includes of your providers often contain more includes. Go over 10 and the result is a PermError: SPF fails for all your email, as if it were forged. The generator adds up the lookups of each service for you. If you are close to the limit, remove services you no longer use, or replace includes with the provider's IP ranges (keeping in mind that you will have to update them yourself).

Examples

Google Workspace only:
v=spf1 include:_spf.google.com ~all

Microsoft 365 + Mailchimp:
v=spf1 include:spf.protection.outlook.com include:servers.mcsv.net ~all

A domain that never sends email:
v=spf1 -all

After publishing, check the result with the SPF Checker, then protect the domain fully with a DMARC record.

Frequently asked questions

Where do I add the SPF record?

In the DNS panel of your domain (often your registrar or Cloudflare), as a TXT record on the domain itself: the name is @ or empty. If there is already a TXT record that starts with v=spf1, edit it instead of adding a new one.

Can I have two SPF records?

No. With two records starting with v=spf1, SPF fails for every email (PermError). Merge them: one record with all the includes and IPs.

What does the lookup counter mean?

SPF allows at most 10 DNS lookups while checking a record. Every include, a, mx, exists and redirect counts, and so do the includes nested inside each service. Over 10, receivers treat the record as broken. ip4 and ip6 are free.

Should I use ~all or -all?

With a DMARC policy, ~all is the usual choice: DMARC decides what happens to failing email, and forwarded messages are not lost. Use -all when you are sure every sender is listed, or for domains that never send email (v=spf1 -all).

My provider is not in the list. What do I add?

Look for "SPF" in your provider's help pages: they give you an include such as include:spf.example.com. Enter the domain after include: in "Other services". If they give you IP addresses instead, add them as ip4/ip6.

How long until the new SPF record works?

As soon as receivers stop using the cached copy of the old one, usually within the TTL of the record (often one hour). Check it with our SPF checker, and watch the changes worldwide with the DNS propagation checker.

Related tools

Last updated: