Christmas−30 % for 12 months with codeGet the offer →
  1. Home
  2. Free tools
  3. SPF generator
Free tool, no sign-up

SPF record generator

With this free SPF record generator, tick the services that send your emails, add your servers and IP addresses, choose the final rule, and copy a TXT record ready to publish. The DNS lookup counter warns you before you reach the limit of 10, and everything happens in your browser.

  • 12 common services to tick
  • DNS lookup counter
  • Nothing is sent to our servers
SPF record generator: mx, ip4, ip6 and include mechanisms assembled into a v=spf1 record ending in -all, with a gauge showing 2 DNS lookups out of 10
Valid SPFA single TXT record
2 DNS lookupsOut of 10 allowed
What the tool does

A correct SPF record, first time

The generator assembles the mechanisms in the right order, checks what you enter and warns you before a setting breaks your SPF.

Common services

Twelve mail services and sending platforms to tick, including Microsoft 365 and Google Workspace, with their official include already written. No more typos in a domain name.

Your own servers

Two boxes to authorise the domain's MX servers and the website's server, useful when your hosting sends emails itself, such as contact forms.

IP addresses

IPv4 and IPv6 addresses, single or as CIDR ranges, turned into ip4 and ip6. A malformed value is flagged and is not added to the record.

Other includes

Add the include of any provider missing from the list, such as invoicing software or a CRM. The name is checked before it is inserted.

Lookup counter

A gauge counts your record's DNS lookups out of the 10 allowed by the standard. It turns orange above 7 and red above 10.

Final rule

Choose -all to reject other servers, ~all to mark them as suspicious or ?all, which is not recommended. Long records are split into chunks of 255 characters.

How it works

Create an SPF record in four steps

Enter the domain

Enter the domain that sends the emails. It appears in the Name column of the result, so you know where to publish.

Tick your services

Select your mail service and your sending tools, then the mx or a boxes if your own servers also send.

Complete the list

Add your IP addresses and any missing includes, then choose the final rule, preferably -all with DMARC.

Copy and publish

Copy the value, replace or create the single TXT record at the root of the domain, then check it with our checker.

SPF record generator: understanding the SPF record

SPF, short for Sender Policy Framework, is defined by RFC 7208. It is a TXT record published at the root of your domain, which answers a simple question: which servers are allowed to send emails on behalf of this domain? When a server receives a message, it looks at the sender's IP address, reads your SPF record and checks whether this address is on the list. It draws a result from this: pass if the server is authorised, fail or softfail if it is not, neutral if the domain does not take a position.

One point is often misunderstood: SPF does not check the address the recipient sees in the “From” field. It checks the envelope address, also called the return address or Return-Path, the one that receives error messages. The two are often identical, but not always, and a fraudster can exploit this difference. That is why SPF must be complemented by DKIM and DMARC.

SPF is nonetheless essential, including for deliverability. Since February 2024, Gmail and Yahoo have asked all senders for SPF or DKIM authentication, and both from those sending large volumes. Without a correct SPF, even your most legitimate messages may be classed as spam, or even rejected. A well built record therefore protects your name as much as it ensures that your quotes, invoices and replies reach their destination.

Anyone can write an SPF record by hand, but there are many pitfalls: a typo in an include, a missing space, two records instead of one, a lookup limit exceeded without knowing it. This SPF record generator builds the record from tick boxes and simple fields, checks the values entered and warns you as soon as a setting causes a problem.

Before generating: take stock of your sending sources

An SPF record is only correct if it is complete. Before ticking anything, list all the tools that send emails with an address on your domain. The list is often longer than you imagine:

  • the company's mail service, for example Microsoft 365 or Google Workspace, or the one provided by your web host,
  • the newsletter or marketing email tool,
  • the online shop or website, which sends order confirmations and form messages,
  • the invoicing, quoting or reminder software,
  • the CRM, the customer support or appointment booking tool,
  • internal devices and servers: a copier that sends scans, an application server, business software.

To make sure you forget nothing, two sources are invaluable. The headers of an email sent by each tool show the server actually used: paste them into our email header analyzer. And if you already have a DMARC record with a reporting address, those reports list every day all the IP addresses sending with your domain.

Using the SPF record generator step by step

The generator runs entirely in your browser. The record updates with every click, and nothing is sent to our servers.

1. Your domain

Enter the domain concerned. It appears in the “Name” column of the result, which shows where to publish the record. If you leave it blank, the tool uses example.com to show you the format.

2. The services that send your emails

Twelve common services are offered as tick boxes, with their official include already written: Microsoft 365, Google Workspace, several French and European mail hosts, and sending platforms such as Brevo, Mailjet, SendGrid, Amazon SES or Mandrill. Ticking Microsoft 365, for example, adds include:spf.protection.outlook.com.

3. Your own servers

Two boxes add mx, if the servers that receive your emails also send them, and a, if the server hosting your website sends messages. The IP address field accepts IPv4 and IPv6 addresses, single or as ranges in CIDR format, separated by commas or spaces: the tool turns them into ip4: and ip6:. The “Other services” field accepts any include supplied by a provider missing from the list. A malformed address or name is flagged, and is not added.

4. The rule for other servers

Three choices end the record: -all to reject, recommended when DMARC is in place, ~all to accept while marking as suspicious, and ?all to say nothing, which is not recommended.

The result

The result is presented as in a DNS zone: TXT type, name, value, with a button to copy. A gauge shows the number of DNS lookups out of 10: it turns orange above 7 and red above 10. If the record exceeds 255 characters, the maximum size of a TXT string, the tool automatically splits it into several quoted chunks, which DNS servers join back together when reading.

SPF mechanisms and qualifiers explained

An SPF record always starts with v=spf1. Then come mechanisms, read from left to right: the first one that matches the sender's IP address gives the result.

MechanismWhat it authorisesDNS lookup
ip4:192.0.2.10An IPv4 address or a range, such as 192.0.2.0/24No
ip6:2001:db8::25An IPv6 address or a rangeNo
aThe addresses of the domain itselfYes
mxThe domain's MX serversYes
include:All the servers authorised by another domain's SPFYes, plus those of that SPF
exists:, ptrAdvanced uses, ptr is discouraged by the standardYes
allEverything else, always lastNo

Each mechanism can be preceded by a qualifier: + (allow, the default value, so rarely written), - (reject), ~ (soft fail) and ? (neutral). That is why -all or ~all is written at the end of the record. Here is a complete example:

v=spf1 mx include:spf.protection.outlook.com ip4:192.0.2.10 ip6:2001:db8::25 -all

In plain terms: the domain's MX servers, Microsoft 365, the server 192.0.2.10 and the server 2001:db8::25 may send, all others fail. This record requires two direct DNS lookups, the one for mx and the one for the include, plus those contained in Microsoft's SPF.

The 10 DNS lookup limit and how to stay within it

To prevent SPF from being used to overload DNS servers, the standard limits to 10 the number of mechanisms that trigger a lookup: include, a, mx, ptr, exists and the redirect modifier. Beyond that, the result is permerror and many receiving servers then treat your SPF as a failure. The standard also limits to 2 the lookups that return nothing, for example an include pointing to a domain that no longer exists.

The trap is cascading lookups. An include pointing to a provider counts as one, but that provider's SPF may itself contain three or four includes, which also count. The generator counts the lookups in your own record and warns you from 8, because it cannot know in advance the content of your providers' records. Once the record is published, the SPF, DKIM and DMARC checker follows each include all the way and gives the real total.

If you exceed the limit, there are several solutions:

  1. Clean up. Remove the services you no longer use. This is the most common cause of exceeding the limit.
  2. Replace a and mx with addresses. If your servers have stable IP addresses, ip4: and ip6: cost no lookups.
  3. Use subdomains. Send the newsletter from news.example.com, with its own SPF. The main domain thus keeps a short list.
  4. Beware of flattening. Replacing an include with the provider's list of addresses reduces the count, but the record becomes wrong as soon as that provider changes its servers, without you being warned.

Publishing and testing your SPF record

The record is published in your domain's DNS zone, at your registrar or DNS host:

  1. First check whether a TXT record starting with v=spf1 already exists. If so, edit it instead of creating a second one.
  2. Create or edit a record of type TXT at the root of the domain. Depending on the interface, the name field stays empty or contains @.
  3. Paste the value copied from the generator, in a single block.
  4. Save, then wait for the DNS caches to expire, according to the TTL of the old record.

What about subdomains?

A subdomain does not inherit the main domain's SPF. If your shop sends from shop.example.com, it needs its own record, published under that name. Conversely, a subdomain that never sends emails can be given an SPF that authorises nobody, v=spf1 -all, which discourages fraudsters from using it. The generator works the same way for a subdomain: simply enter its full name in the first field.

Then check the publication from a terminal:

dig +short TXT example.com
nslookup -type=TXT example.com

You can also view the record with our DNS lookup tool, then check that it is visible everywhere with the DNS propagation tool. Finally, send a real message to our email test: it shows the SPF result obtained by a receiving server, with the IP address actually used.

Common SPF errors and how to fix them

  • Two SPF records. Adding a new service by creating a second TXT instead of completing the first one causes a permerror: both are ignored. Merge them into one, with a single final rule.
  • A forgotten service. Its messages fail SPF and end up in spam, or are rejected if DMARC is strict. Take stock again and add its include.
  • Choosing +all. It allows any server in the world to send for you. It is worse than having no SPF at all, because it gives an appearance of legitimacy.
  • A typo in an include. A misspelled name returns nothing, counts as a void lookup and can put the record in error. Always copy the include from the provider's official documentation.
  • A missing final rule. Without all at the end, or a redirect, nothing is said about unlisted servers. Protection is then very weak.
  • An SPF never reviewed. A provider abandoned two years ago remains authorised to send for you as long as its include is in the record. Reread your SPF whenever you change tools and remove what is no longer used.
  • Private IP addresses. An address such as 192.168.1.10 makes no sense in a public SPF: only servers seen from the Internet count.

SPF is not enough: DKIM, DMARC and protection

SPF is a first building block, essential but insufficient. It fails as soon as a message is forwarded automatically, since the forwarding server is not on your list. Above all, it does not protect the address shown to the recipient. For that, enable DKIM signing at each of your sending services, then publish a DMARC policy with our DMARC generator. DMARC is what requires the validated domain to match the visible address, and asks mail providers to reject fakes.

With these three records in place, you stop people from writing in your name. What remains is protecting what you receive: phishing, booby-trapped attachments, fake supplier fraud. Passmundi filters incoming mail before it reaches your mailboxes, validates senders and makes your DMARC reports readable. Discover Passmundi plans or explore all the free tools.

Key points

SPF mechanisms and their cost in DNS lookups

MechanismRoleDNS lookup
ip4IPv4 address or rangeNone
ip6IPv6 address or rangeNone
aDomain addressesOne
mxDomain MX serversOne
includeA provider's SPFOne, plus its own
-all or ~allRule for everything elseNone
Frequently asked questions

SPF record generator: your questions

How do I create an SPF record?

List all the services that send emails with your domain: mail service, newsletter, online shop, invoicing. Tick them in the SPF record generator, add your IP addresses if needed, choose the final rule and copy the value. Then publish it as a single TXT record at the root of the domain, and check the result with an SPF checker.

Where do I publish the SPF record in my DNS?

In your domain's DNS zone, at your registrar or DNS host. Create a TXT record at the root of the domain: depending on the interface, the name field stays empty or contains the @ symbol. If a record starting with v=spf1 already exists, edit it rather than adding a second one.

What is the difference between -all and ~all?

With -all, any server missing from the list gets a fail result: the message may be rejected. With ~all, it gets a softfail: the message is usually accepted but considered suspicious. ~all is a cautious choice during setup. Once the list is complete and DMARC is in place, -all is the clearest choice.

Can a domain have two SPF records?

No. If two TXT records start with v=spf1, the standard requires a permerror result and neither is taken into account. They must be merged into a single record, with all the mechanisms in a row and a single final rule. This is the most common error after adding a new sending service.

What should I do if my SPF exceeds 10 DNS lookups?

First remove the services you no longer use. Then replace the a and mx mechanisms with ip4 and ip6 addresses when your servers have stable addresses. You can also hand some sending, such as the newsletter, to a subdomain with its own SPF. Avoid copying a provider's addresses in place of its include.

How do I add Microsoft 365 or Google Workspace to my SPF record?

In the generator, simply tick the corresponding box. For Microsoft 365, the tool adds include:spf.protection.outlook.com. For Google Workspace, it adds include:_spf.google.com. If you are editing an existing record by hand, insert this include before the final rule, without creating a second record, then check the total number of DNS lookups.

Should I put mx and a in an SPF record?

Only if these servers actually send emails. The mx mechanism authorises your receiving servers, which is useful when they are also used for sending. The a mechanism authorises the domain's address, often the website's server. Each one costs a DNS lookup: if they send nothing, do not add them, your SPF will only be stricter.

How do I add an IP address to an SPF record?

Enter the address in the generator's dedicated field: an IPv4 address becomes ip4:192.0.2.10, an IPv6 address becomes ip6:2001:db8::25. You can also enter a range in CIDR format, such as 198.51.100.0/24. These mechanisms cost no DNS lookups. Only add public addresses, never local network addresses.

How long does it take for an SPF record to take effect?

As long as it takes for DNS caches to expire. It depends on the time to live, or TTL, of the old record: usually from a few minutes to a few hours. During this period, some servers still see the old version. The DNS propagation tool shows which public resolvers already display the new value.

Is SPF enough to stop my domain being spoofed?

No. SPF checks the envelope address, which is invisible to the recipient, and not the address displayed in the From field. It also fails with automatic forwarding. To really protect your name, add a DKIM signature to your outgoing emails and a DMARC policy that requires alignment and asks mail providers to reject fake messages.

Is the SPF record generator free?

Yes. The SPF record generator is free, with no sign-up and no usage limit. You can create and adjust as many records as you need, for all your domains and subdomains. The SPF, DKIM and DMARC checker, also free, then lets you check the published record and find out the real number of DNS lookups.

Is the information entered in the SPF generator stored?

No. The generator runs entirely in your browser. The domain, the services ticked and the IP addresses entered are only used to build the record shown on screen. Nothing is sent to our servers, nothing is kept, and closing the page erases everything. So you can enter your servers' addresses with complete peace of mind.

The complete toolbox

All our free tools, in one place

25 free tools, no sign-up needed, to check your email, your domain and your website. Each one gives a clear result and the steps to follow.

Email and deliverability 10

SPF, DKIM and DMARC checkerEmail authentication
Free

An A to F grade for your domain, with the exact fix to publish for each issue.

  • SPF, DKIM and DMARC read and explained
  • DMARC policy and alignment
  • Fixes ready to copy
Open the tool
Domain security auditDomain security
Free

Free domain security check: SPF, DKIM, DMARC, MTA-STS, blacklists, certificate and lookalike domains. Get an A to F grade and fixes ready to copy.

  • A to F grade in 20 to 40 seconds
  • Fixes ready to copy
  • Free weekly monitoring
Open the tool
Email spam testDeliverability
Free

Send a message to a test address and get a score out of 100: authentication, reputation, content.

Open the tool
MX lookupReceiving
Free

Where your mail arrives, in what order, and whether it goes through a filter before your inbox.

Open the tool
DMARC generatorAuthentication
Free

Your DMARC record in one minute, with the right policy to get started safely.

Open the tool
SPF generatorAuthentication
You are here

A correct SPF built from your sending services, without exceeding the ten lookup limit.

Email header analyzerInvestigation
Free

Paste a message's headers: route, delays and authentication checks translated into plain English.

Open the tool
MTA-STS, TLS-RPT and BIMIAdvanced security
Free

Encryption enforced between servers, TLS reports, brand logo and DNSSEC in a single test.

Open the tool
Blacklist checkerReputation
Free

Is your IP address or domain on anti-spam lists? Thirteen lists checked.

Open the tool
Email signature generatorBrand image
Free

A professional signature in six steps, compatible with every mail app.

Open the tool

Domains and DNS 6

DNS lookupRecords
Free

All of a domain's records, A, MX, TXT, NS, CAA and the rest, on the resolver of your choice.

  • Every record type
  • A choice of seven public resolvers
  • Explanations for each value
Open the tool
DNS propagationDNS changes
Free

Is a change already visible everywhere? The answer from nineteen resolvers around the world.

Open the tool
Reverse DNS lookup (PTR)IP address
Free

The name associated with an IP address, checked in both directions, just as mail servers do.

Open the tool
Whois and RDAP lookupOwnership
Free

Registrar, creation and expiry dates, name servers and status of a domain or an IP.

Open the tool
Lookalike domain finderSpoofing
Free

Names close to yours that are already registered, which fraudsters could use against your customers.

Open the tool
Punycode converterAccented names
Free

Accented domains and the xn-- form, in both directions, with detection of misleading characters.

Open the tool

Websites and security 8

Speed testPerformance
Free

An A to F grade, Core Web Vitals, image-by-image loading and advice, on mobile and desktop.

  • Google metrics and server analysis
  • Request waterfall and page weight
  • PDF report to share
Open the tool
Cookie scannerGDPR
Free

Cookies before and after consent, banner, providers and a GDPR register ready to publish.

Open the tool
SSL certificate checkerEncryption
Free

Validity, issuer, chain, names covered and expiry date of a certificate, on any port.

Open the tool
HTTP headers and redirectsWeb server
Free

The redirect chain of an address and the grade of its security headers.

Open the tool
What is my IPNetwork
Free

Your public IP address, IPv4 and IPv6, its name, its operator and its country.

Open the tool
Internet speed testConnection
Free

Download and upload speed, latency and jitter of your connection, measured live in your browser.

Open the tool
IP and CIDR subnet calculatorNetwork
Free

Ranges, masks, subnets and number of addresses of an IPv4 or IPv6 network.

Open the tool
Password generatorSecurity
Free

Strong passwords and passphrases, created in your browser, never sent.

Open the tool

Migration and handy tools 1

Email migrationChanging host
Free

Copy all the messages from one mailbox to another, folders and dates included, without deleting anything.

Open the tool

Your SPF is ready, what about your mailboxes?

SPF says who can write in your name. Passmundi protects what you receive: sender validation, with spam, viruses, phishing and CEO fraud stopped before they reach your mailboxes.