Skip to content

dns.computer

Tech Blog

  • Home
  • About me
  • Articles
  • Home
  • DNS records
  • How to Create an SPF Record: Generator, Examples, and Common Mistakes
create an spf record

How to Create an SPF Record: Generator, Examples, and Common Mistakes

Posted on November 16, 2026November 16, 2026 By Beloslava Petrova No Comments on How to Create an SPF Record: Generator, Examples, and Common Mistakes
DNS records

If you need to create an SPF record for your domain, the most important thing is getting one detail right before you touch DNS: you need to know exactly which servers and services are allowed to send email on your behalf.

Once you have that list, building the record itself is fairly straightforward. You can write it manually or use an SPF record generator to avoid syntax mistakes. In this guide, we will do both, look at useful online tools, and show you how to check that the finished record actually works.

What Do You Need Before You Create an SPF Record?

SPF stands for Sender Policy Framework. It tells receiving mail servers which systems are authorized to send email using your domain.

Before creating the record, make a list of everything that sends email for you. That might include your own mail server, Google Workspace, Microsoft 365, a newsletter service, CRM, support platform, transactional email provider, or another third-party service.

This step matters more than the generator itself. An SPF generator can build the correct syntax, but it cannot know about an email platform you forgot to include.

If SPF is new to you, our Ensure mail delivery with DNS SPF record guide explains how SPF works and why it matters for email delivery.

How to Create an SPF Record

Every SPF record starts with:

v=spf1

This identifies the TXT value as an SPF version 1 policy.

After that, you add the systems that are allowed to send email.

For example:

v=spf1 ip4:203.0.113.10 include:_spf.example.net ~all

Each part has a fairly simple purpose:

SPF PartWhat It Means
v=spf1Identifies the SPF version
ip4:203.0.113.10Allows a specific IPv4 address
include:_spf.example.netIncludes the SPF policy of another sender
~allMarks other senders as SoftFail

Other commonly used mechanisms include:

ip6: for an IPv6 address

a to authorize addresses associated with an A or AAAA record

mx to authorize servers listed in the domain’s MX records

include: to authorize sending infrastructure defined by another domain

all to define what happens when none of the previous mechanisms match

You do not need to include every possible mechanism. A good SPF record should contain only what your actual mail setup needs.

Online SPF Record Generator Tools

If you would rather not build the SPF string manually, an online generator can make the process considerably easier.

There are plenty of SPF tools online, but three are enough for most users.

1. ClouDNS SPF Record Generator

The ClouDNS SPF Record Generator is a free tool designed specifically for creating SPF records. You provide information about the mail servers and IP addresses authorized to send email for the domain, generate the record, and then publish the resulting value in DNS.

It is a good starting point if you do not want to assemble SPF syntax manually, especially when the record contains several IP addresses or external email services.

2. MXToolbox SPF Record Generator

The MXToolbox SPF Record Generator can create a new record or help modify an existing SPF configuration.

That second option is particularly useful if you already have SPF but need to add another email service without accidentally creating a second record.

3. EasyDMARC SPF Record Generator

The EasyDMARC SPF Record Generator gives you direct control over individual SPF mechanisms. You can add include, IPv4, IPv6, A, MX, and other values and choose the policy used at the end of the record.

It is useful when you already understand the basics and want more control over the finished SPF policy.

How to Use an SPF Record Generator

Although the interfaces differ, most SPF generators follow roughly the same process.

Start by entering your domain and adding the sources that are allowed to send email. Depending on the tool, these may be IP addresses, mail servers, or include values supplied by third-party email providers.

Then choose how the SPF policy should treat senders that do not match the authorized sources.

The generator will produce something similar to:

v=spf1 ip4:203.0.113.10 include:_spf.example.net ~all

Before copying it into DNS, read through the result.

A generator reduces syntax mistakes, but you still need to make sure that every legitimate sender is present and that old services you no longer use have not been carried into the new configuration.

What Do ~all, -all, and ?all Mean?

The final part of an SPF record deserves some attention because it defines the result for senders that do not match the mechanisms before it.

-all means Fail. The domain is making a strong statement that unmatched senders are not authorized.

~all means SoftFail. The sender is probably not authorized, but the policy is less definitive.

?all produces a Neutral result.

You may also encounter:

+all

This effectively allows any sender to pass that mechanism and defeats most of the reason for publishing SPF in the first place. It is generally something you should avoid in a normal SPF policy.

Do not choose -all simply because it looks more secure. Make sure you have identified all legitimate sending sources first. A strict policy with a missing mail service can cause genuine messages to fail SPF.

How to Publish an SPF Record in DNS

Once the SPF record is ready, it needs to be published in the DNS zone for the sending domain.

SPF policies are published as a DNS TXT record.

A typical configuration might look like this:

FieldExample
TypeTXT
Host / Name@
Valuev=spf1 ip4:203.0.113.10 include:_spf.example.net ~all
TTLProvider default or your chosen value

Different DNS providers use slightly different labels. Some use @ for the root domain, while others expect the field to be blank or use the domain itself.

TXT records are also used for DKIM, DMARC, domain verification, and other purposes. Our DNS TXT record guide explains these use cases in more detail.

How to Check If Your SPF Record Works

Do not stop after clicking Save.

Check the published record to make sure DNS is actually returning the value you expected.

With dig, run:

dig example.com TXT

Or with nslookup:

nslookup -type=TXT example.com

Look for a TXT value beginning with:

v=spf1

You can also use an online DNS lookup tool. Our guide on how to check DNS records for a domain covers both browser-based tools and command-line methods for checking TXT and other DNS records.

If you prefer the terminal, Dig Command Explained for Beginners shows how to read a dig response, while the NSlookup command guide covers the simpler alternative available on many operating systems.

Why Your New SPF Record May Not Appear Immediately

You may publish the SPF record correctly and then check it through another resolver only to find that the previous value is still there.

That does not necessarily mean something went wrong.

DNS resolvers cache records according to their DNS TTL, or Time to Live. Until the cached version expires, a resolver may continue returning the previous TXT record.

This is also why recent SPF changes may appear at different times depending on which resolver you use. The same behavior is commonly described as DNS propagation.

If the authoritative DNS server already returns the new SPF record while another resolver still shows the old one, caching is usually the first thing to investigate.

You Should Have Only One SPF Record

This is one of the most important SPF rules.

A domain should not publish two separate SPF records beginning with v=spf1 for the same name.

For example, this is wrong:

v=spf1 include:_spf.provider-one.com ~all

and separately:

v=spf1 include:_spf.provider-two.com ~all

If both services send email for the domain, combine them:

v=spf1 include:_spf.provider-one.com include:_spf.provider-two.com ~all

This is a particularly common problem when a company adds a new email platform and simply follows the provider’s setup instructions without checking whether SPF already exists.

Before creating another SPF record, check the domain’s existing TXT records first.

Watch the SPF 10 DNS Lookup Limit

This is where larger SPF configurations can become surprisingly tricky.

SPF evaluation has a limit of 10 DNS-querying mechanisms and modifiers.

Mechanisms that can contribute to that limit include:

  • include
  • a
  • mx
  • ptr
  • exists
  • redirect

There is an important twist: one include can point to another SPF record that contains additional includes.

So your SPF value can look fairly short while the complete evaluation requires many DNS queries behind the scenes.

Direct ip4 and ip6 mechanisms do not require this type of additional DNS lookup.

If your organization uses several third-party email services, check the lookup count whenever you add another sender. Going over the limit can result in an SPF PermError.

Common Mistakes When Creating an SPF Record

Most SPF problems are not caused by exotic DNS issues. They usually come from a handful of configuration mistakes.

Forgetting a legitimate sender is probably the most obvious. If your newsletter platform sends email for the domain but is missing from SPF, those messages may fail authentication.

Creating multiple SPF records is another common mistake. Add new senders to the existing policy instead of publishing another v=spf1 record.

Exceeding the 10 DNS lookup limit often happens when several third-party services are chained together through include mechanisms.

Keeping old services forever makes the policy harder to understand and wastes lookup capacity. Remove email providers that no longer send on behalf of the domain.

Using the wrong include value can also break authentication. Do not guess what the provider’s SPF include should be. Use the exact value supplied in its documentation.

Finally, do not forget to test the finished record. A perfectly designed SPF policy is not useful if it was accidentally published under the wrong hostname.

A Simple SPF Record Example

Imagine a company sends email from:

  • One server at 203.0.113.10
  • A third-party mail provider using _spf.mailprovider.example

The SPF record could look like:

v=spf1 ip4:203.0.113.10 include:_spf.mailprovider.example -all

The logic is straightforward.

Allow the specified IP address.

Allow servers authorized by the third-party provider.

Fail other senders.

Real SPF records can become more complicated, but the principle stays the same: describe who is allowed to send, then define the policy for everyone else.

SPF Is Only One Part of Email Authentication

Creating SPF is an important step, but it should not be treated as the entire email security setup.

SPF is commonly used alongside DKIM and DMARC.

SPF checks whether the sending infrastructure is authorized.

DKIM uses cryptographic signatures to help verify the message and sending domain.

DMARC builds on SPF and DKIM and lets domain owners define a policy and receive authentication reports.

If you are setting up email authentication from scratch, SPF is a good starting point, but the long-term goal should usually be a correctly configured combination of SPF, DKIM, and DMARC.

Frequently Asked Questions About Creating an SPF Record

Q1: How Do I Create an SPF Record? – Identify every service authorized to send email for your domain, create one SPF policy beginning with v=spf1, add the required mechanisms, choose the final policy, and publish it as a TXT record in DNS.

Q2: Can I Use an SPF Record Generator? – Yes. Tools such as ClouDNS, MXToolbox, and EasyDMARC can help build SPF syntax and reduce manual configuration mistakes.

Q3: Can I Have More Than One SPF Record? – No. You should have only one SPF policy for the same domain or hostname. If you use several email providers, combine them into one SPF record.

Q4: Should SPF Be a TXT Record? – Yes. SPF policies are published in DNS using TXT records.

Q5: What Does ~all Mean in SPF? – It produces a SoftFail result for senders that do not match the authorized mechanisms in the SPF record.

Q6: What Does -all Mean in SPF? – It produces a Fail result for senders that do not match the authorized SPF mechanisms.

Q7: What Is the SPF 10 Lookup Limit? – SPF evaluation allows a maximum of 10 DNS-querying mechanisms and modifiers. Going beyond the limit can produce a PermError.

Q8: How Can I Check My SPF Record? – Query the domain’s TXT records with an online DNS checker, dig, or nslookup, then confirm that the expected v=spf1 value is returned.

Q9: How Long Does an SPF Record Take to Work? – The new value can appear on the authoritative DNS server quickly, but other resolvers may temporarily continue using cached information according to the previous TTL.

Conclusion

The easiest way to create an SPF record is to start with an accurate list of your email senders and keep the policy as simple as possible.

An SPF generator can handle much of the syntax, but the important decisions still belong to you: which systems are authorized, which services are no longer needed, and how strict the final policy should be. Publish one SPF TXT record, stay within the DNS lookup limit, and always verify the result after making changes.

Related posts:

How to Check DNS Records for a Domain?

October 8, 2026

What Is DNS TTL and Why Does It Matter?

September 1, 2026

Dig Command Explained for Beginners

August 11, 2026
author photo
Beloslava Petrova

Hi, I’m Bella, a technology enthusiast who enjoys making complex tech topics clear, practical, and easy to understand. Outside of writing, I love trail running, biking, traveling, and photography.

Tags: Create an SPF Record dig command DKIM DMARC DNS lookup DNS Propagation DNS records DNS TTL DNS TXT record Email Authentication Email Deliverability Email Security NSlookup Sender Policy Framework SPF 10 Lookup Limit SPF Checker SPF Configuration SPF DMARC DKIM SPF DNS SPF DNS Record SPF Example SPF Generator SPF Lookup SPF record SPF Record Generator SPF Setup SPF Syntax SPF TXT Record SPF Validation

Post navigation

❮ Previous Post: DNS Speed Test: How to Find the Fastest DNS Server

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts

  • How to Create an SPF Record: Generator, Examples, and Common Mistakes
  • DNS Speed Test: How to Find the Fastest DNS Server
  • Wget Command: How to Use It with Examples
  • Fastest Authoritative DNS Providers in 2026: DNSPerf Ranking Compared
  • Hostname vs Domain Name: What’s the Difference?

Recent Comments

No comments to show.

Categories

  • Cloud
  • Commands
  • DNS
  • DNS records
  • DNS services
  • Network
  • Security

Archives

  • November 2026
  • October 2026
  • September 2026
  • August 2026
  • July 2026
  • June 2022
  • March 2022
  • December 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021
  • April 2021
  • March 2021
  • February 2021
dns.computer
Tech Blog about DNS, networking and cloud
  • Home
  • Articles
  • About me

Copyright © 2026 dns.computer.

Theme: Oceanly by ScriptsTown