Free tools

SPF record generator

Build the SPF record of your domain from the services that actually send your mail. The generator counts the DNS lookups the way receivers do and warns you before you reach the limit of 10.

The record is built in your browser: nothing you type is sent to us.

SPF lists the servers allowed to send mail for your domain. Tick every service that sends mail with your address: your mailbox, newsletters, invoicing, helpdesk.

Services that send your mail
Mail from other servers

Check the record once published CAA, MTA-STS and security.txt generators

What the generator writes

One record, starting with v=spf1
Everything goes into a single TXT record, as SPF requires. Never publish a second one next to it.
The includes of your providers
Each service you tick adds the include it documents, counted with its own nested includes: Google Workspace alone costs 4 lookups, Microsoft 365 costs 2.
Your own servers
mx and a cover the servers of your MX records and of your website; ip4 and ip6 add fixed addresses without costing a lookup.
The ending
~all flags mail from other servers and is the right choice with DMARC; -all refuses it outright.
Warnings before you publish
More than 10 lookups, an invalid address or include, and a record longer than 255 characters are flagged before you copy anything.

How to publish the record

Name
@, the domain itself, or an empty name, depending on your DNS panel: SPF is read on the domain of the Return-Path, which is usually your domain.
Type and value
TXT, with the value exactly as generated. Most panels add the quotation marks themselves; if you type them, use straight quotes.
Replace, never add
If the domain already has a v=spf1 record, edit that record instead of adding a second one.
Then check it
The change is visible within minutes or a few hours (the record’s TTL). Run the SPF checker on your domain to confirm the lookup count and the ending.

Mistakes to avoid when writing an SPF record

Most broken SPF records come from a handful of mistakes. Each one below comes with the message it produces and how to avoid it.

A second SPF record

Why. Adding a new provider by creating another v=spf1 record gives every receiver a permerror: multiple SPF records found.

Fix. Add the new include to the existing record. The generator always produces one record with everything in it.

A forgotten sender

Why. Invoices, website forms or a helpdesk that send with your address but are not listed get spf=softfail and land in spam once DMARC is enforced.

Fix. Tick every service that sends with your address. Your DMARC reports list every sender, including the ones nobody remembered.

Too many includes

Why. Past 10 DNS lookups, SPF returns permerror: too many DNS lookups for every message.

Fix. Remove old providers, use ip4 ranges where a provider documents fixed addresses, and move bulk mail to a subdomain with its own SPF record.

+all or ?all “to make it pass”

Why. +all lets any server on the internet send as your domain; ?all says nothing. Both remove the protection SPF exists for.

Fix. End with ~all with DMARC, or -all without it. Fix the missing senders instead.

a on shared hosting

Why. The a mechanism authorises the address of your website. On shared hosting, hundreds of other sites use that address, and all of them can then send as you.

Fix. Leave a unticked unless your website’s server is yours alone; list the mail service your site uses instead.

Questions

Where do I put the SPF record?

On the domain itself, as a TXT record. In most DNS panels the name is @ or left empty. Subdomains that send mail need their own record.

Do I need SPF if my domain never sends e-mail?

Yes: v=spf1 -all says that no server may send for the domain. Add a DMARC record at p=reject and a null MX (MX 0 .) to close the domain completely.

Can an SPF record be longer than 255 characters?

Yes, as several strings in one TXT record, which receivers join together. Most DNS panels split a long value for you; what must never happen is a value cut short.

Which includes do the providers use?

The generator knows the documented include of the main mail, newsletter and transactional services. For any other, copy the include from the provider’s help and add it in Other includes.

Is the record built on your servers?

No, in your browser. Nothing you type is sent to us.