SPF Record Generator
Pick the services that send your mail and get one SPF record, with the DNS lookups it costs receivers counted live as you build it.
Loads your domain's SPF record into the form, senders and all. Or pick senders below: it updates as you go.
Built in your browser. Only DNS questions leave it, over HTTPS to Cloudflare's resolver (Google's as a second opinion).
An example record for example.com
Type your domain above to start from what it publishes now, or change anything below. The record on the right updates as you go.
Unlisted servers are marked suspicious, not refused. With DMARC at quarantine or reject, DMARC decides on DKIM. M3AAWG recommends ~all.
What receivers spend on this record
/ 10 lookups used
110
DNS lookup void
Counting the includes…
Where the lookups go
Before you publish
One record, with nothing receivers would skip or misread.
Where do I paste this?
Pick your DNS host: the fields below are written the way its form wants them.
example.com. 3600 IN TXT "v=spf1 include:_spf.google.com ~all"
After you publish
How do I create an SPF record?
List every service that sends mail as your domain, put their include: terms and your own servers' addresses in one TXT record at the domain, and end it with ~all.
Put the cheap terms first: IP addresses cost no DNS lookup, a and mx cost one each, includes cost one plus whatever they contain.
Then count: receivers stop at 10 DNS lookups. The SPF builder above walks every include live, so the count is what receivers will see.
ip4:192.0.2.250 lookupsinclude:_spf.google.com1 lookupinclude:spf.mailjet.com1 lookup~all0 lookups
The count receivers will reachEvery include walked live from your browser, nested ones too, exactly as a receiver counts.One cell per lookupColoured by the sender that spends it; past 10 the cells are hatched: a permanent error.Where the lookups goEach term with its mark, its nested includes and what it costs.Who spends mostOver 10, the biggest spenders and the honest ways back under, flattening's catch included.Senders that live elsewhereServices whose SPF goes on a subdomain, or nowhere, say where.SPF record syntax: what goes in an SPF record?
Mechanisms that name who may send (ip4, ip6, a, mx, include, exists) and one ending, all or redirect, each with a qualifier; every term that asks DNS costs one of the 10 lookups.
A qualifier says what a match means: + pass (the default), - fail, ~ softfail, ? neutral. Receivers read left to right and stop at the first match.
ptr is deprecated and slow: don't use it.
| Term | Example | DNS lookups | Use it for |
|---|---|---|---|
| ip4 | ip4:192.0.2.0/24 | 0 | Your own IPv4 servers |
| ip6 | ip6:2001:db8::/32 | 0 | Your own IPv6 servers |
| a | a | 1 | The domain's own address |
| mx | mx | 1 + up to 10 names | Inbound servers that also send |
| include | include:_spf.google.com | 1 + its own | A service's record |
| exists | exists:%{i}._spf.example.com | 1 | Per-address checks (macros) |
| redirect | redirect=_spf.example.com | 1 | Use another domain's whole record |
| all | ~all | 0 | Everything else (the ending) |
+pass-fail~softfail?neutralSPF records for Google Workspace, Microsoft 365 and others
Google Workspace is include:_spf.google.com and Microsoft 365 is include:spf.protection.outlook.com; most services publish one include: term, and some need nothing in your record at all.
Each cost below was measured on the service's live record and includes everything nested inside it, which is what a receiver spends.
Services marked elsewhere send with their own return path or a subdomain of yours, so their SPF lives there.
| Service | Add to your record | Lookups | Where |
|---|---|---|---|
| Google Workspace | include:_spf.google.com | 1 | your record |
| Microsoft 365 | include:spf.protection.outlook.com | 1 | your record |
| Zoho Mail | include:zohomail.com | 2 | your record |
| Amazon SES | include:amazonses.com | 1 | a subdomain |
| SendGrid | include:sendgrid.net | 2 | a subdomain |
| Mailgun | include:mailgun.org | 5 | a subdomain |
| Mailchimp | — | — | nothing to add |
| Brevo | — | 1 | nothing to add |
| HubSpot | include:<HubID>.spf0N.hubspotemail.net | — | your record |
| Salesforce | include:_spf.salesforce.com | 2 | your record |
| Zendesk | include:mail.zendesk.com | 1 | your record |
| Freshdesk | include:email.freshdesk.com | 7 | your record |
| Postmark | — | 1 | nothing to add |
| Mimecast (global) | include:_netblocks.mimecast.com | 9 | your record |
| Proton Mail | include:_spf.protonmail.ch | 2 | your record |
| Fastmail | include:spf.messagingengine.com | 1 | your record |
What is the SPF 10-lookup limit?
Receivers stop after 10 terms that ask DNS, nested includes counted, and SPF then fails with a permanent error for every message; a third lookup that comes back empty fails it too (RFC 7208).
Get back under by moving a sender to a subdomain with its own record, dropping a or mx if those servers don't send, or asking the vendor for a narrower include.
Flattening, replacing an include by its IP addresses, saves lookups but goes stale the day the vendor changes addresses: recheck it every month.
12 / 10 · permanent error
mx1include:spf.protection.outlook.com1include:email.freshdesk.com7include:_spf.salesforce.com2include:mail.zendesk.com1Should SPF end with ~all or -all?
Use ~all on a domain that sends mail and -all on one that doesn't: with DMARC at enforcement, DMARC decides on DKIM, while -all can get forwarded mail refused before DMARC runs.
M3AAWG recommends ~all for sending domains and -all for domains that send no mail. Google documents ~all for Workspace; Microsoft documents -all for Microsoft 365.
~allsoftfailAccepted, marked suspicious; DMARC decides with DKIM-allfailMay be refused at once, even if DKIM passes?allneutralAs if you had no SPFWhich senders don't need to be in your SPF record?
Services that send with their own return path, like Mailchimp, Postmark, SparkPost, Klaviyo and Shopify, pass SPF on their own domain; Amazon SES, SendGrid and Mailgun belong on a sending subdomain of yours.
SPF checks the envelope sender (Return-Path), not the From address people see. For DMARC those services align through DKIM, so publish their DKIM records instead.
From: news@example.comReturn-Path: bounce@esp.example.netNothing to add here
On a subdomain of yours
Can a domain have two SPF records?
No: with two v=spf1 records at one name, receivers stop with a permanent error and SPF fails, so merge them into one record.
Keep every sender from both, one ending, and count the lookups of the merged record: two records that each fit can be over 10 together.
v=spf1 include:_spf.google.com ~allv=spf1 include:spf.protection.outlook.com -allOne recordv=spf1 include:_spf.google.com include:spf.protection.outlook.com ~allHow do long SPF records work with DNS hosts?
A TXT string holds 255 bytes; longer records are split into several strings that receivers join with nothing between them, and most DNS hosts split them for you.
Cloudflare and Azure take the whole value in one field; Route 53 and Google Cloud DNS want quoted 255-byte strings. RFC 7208 asks to keep the whole answer under 450 bytes.
v=spf1 ip4:198.51.100.1 ip4:198.51.100.2 ip4:198.51.100.3 ip4:198.51.100.4 ip4:198.51.100.5 ip4:198.51.100.6 ip4:198.51.100.7 ip4:198.51.100.8 ip4:198.51.100.9 ip4:198.51.100.10 ip4:198.51.100.11 ip4:198.51.100.12 ip4:203.0.113.20 ip4:203.0.113.21 ip4:203.0.113.22 ip4:203.0.113.23 ip4:203.0.113.24 include:_spf.google.com ~allexample.com. 3600 IN TXT ( "v=spf1 ip4:198.51.100.1 ip4:198.51.100.2 ip4:198.51.100.3 ip4:198.51.100.4 ip4:198.51.100.5 ip4:198.51.100.6 ip4:198.51.100.7 ip4:198.51.100.8 ip4:198.51.100.9 ip4:198.51.100.10 ip4:198.51.100.11 ip4:198.51.100.12 ip4:203.0.113.20 ip4:203.0.113.21 ip4:203" ".0.113.22 ip4:203.0.113.23 ip4:203.0.113.24 include:_spf.google.com ~all" )
SPF Record Generator FAQ
What is an SPF record?
What is the SPF record for Google Workspace?
What is the SPF record for Microsoft 365?
Can I have two SPF records?
What happens if my SPF record has more than 10 lookups?
Should I use ~all or -all?
Do subdomains need their own SPF record?
Where do I add the SPF record?
What is SPF flattening, and should I use it?
Is the SPF generator free, and is anything sent to your server?
Missing something?Suggest a feature or a new tool
Related tools
DMARC Record Generator
Build your DMARC record for RFC 9989, starting from the one you publish now, and see what receivers will do with mail that fails.
DKIM Record Generator
Create a DKIM key pair in your browser and get the selector._domainkey TXT record to publish
SPF Record Checker
Validate SPF records and check DNS lookup count per RFC 7208
DMARC Checker
Check any domain's DMARC policy the way receivers read it, with reports, SPF and DKIM
DKIM Checker
Find a domain's DKIM keys across 140 common selectors, or verify an email's signature
MX Lookup
Find mail exchange records and mail server details
Email Header Analyzer
Parse raw email headers and trace the email journey
BIMI Record Checker
Check BIMI records, SVG Tiny PS logos and VMC certificates, and which inboxes show the logo





