To create an SPF record, add one TXT record at the root of your domain (host @) whose value starts with v=spf1, lists every service that sends email for you, and ends with ~all or -all. For a domain on Google Workspace only, that is v=spf1 include:_spf.google.com ~all. If several services send for you, put them all in that one record. The free SPF record generator builds it from a list of providers and counts the DNS lookups for you.
What an SPF record does
SPF (Sender Policy Framework) tells receiving mail servers which servers are allowed to send mail using your domain. When Gmail or Outlook gets a message, it looks up your SPF record and checks whether the sending server is on the list. A missing or broken record makes your real mail look suspicious, and since 2024 Google and Yahoo require SPF or DKIM from everyone and both from bulk senders (see our page on bulk sender requirements). SPF works together with DKIM and DMARC; our DMARC guide covers the next step.
The parts of an SPF record
| Part | Example | Meaning |
|---|---|---|
| Version | v=spf1 | Always first. Marks the TXT record as SPF. |
| include | include:_spf.google.com | Also allow every server in that provider's own SPF record. Counts as a DNS lookup, plus any lookups inside it. |
| ip4 / ip6 | ip4:203.0.113.10 | Allow one server address or a range. No DNS lookup. |
| a / mx | mx | Allow the servers in your domain's A or MX records. Each is a lookup. |
| all | ~all or -all | What to do with everyone else: soft fail (~) or fail (-). Always last. |
Create your SPF record step by step
- List everyone who sends as you. Your mailbox provider, plus newsletter tools, your CRM, invoicing or shop platform, help desk and website contact form. Forgotten senders are the most common cause of SPF failures.
- Check for an existing record. Run your domain through the email deliverability checker. If a
v=spf1record already exists, edit it; never add a second one. - Build the value. In the SPF generator, tick your providers, add any custom includes or IP addresses, and pick
~allor-all. It shows the record and the lookup count. - Add it in your DNS. At your domain host (Cloudflare, GoDaddy, Namecheap and so on): type TXT, host or name @ (or blank, depending on the host), value = the record. Save.
- Wait and check. Google says SPF can take up to 48 hours to start working. Then run the checker again and send yourself a test message.
Examples you can copy
| Your setup | SPF record |
|---|---|
| Google Workspace only | v=spf1 include:_spf.google.com ~all |
| Microsoft 365 only | v=spf1 include:spf.protection.outlook.com -all |
| Google Workspace + Microsoft 365 during a move | v=spf1 include:_spf.google.com include:spf.protection.outlook.com ~all |
| Your own mail server at one address | v=spf1 ip4:203.0.113.10 -all |
| A domain that never sends email | v=spf1 -all |
The Google and Microsoft values come from their own setup pages: Google Workspace Admin Help and Microsoft Learn (checked November 2026). For any other service, search its help pages for "SPF" to get its include value, as these change from time to time. The IP address 203.0.113.10 is an example only.
~all or -all?
The providers disagree, and both are reasonable. Google recommends ~all (soft fail): mail from unlisted servers is accepted but marked. Microsoft recommends -all (hard fail) for Microsoft 365 domains, because DMARC can then act on messages that fail SPF and carry no DKIM signature. A practical rule: start with ~all while you are still finding all your senders, and move to -all once your DMARC reports show every real sender passing. For a domain that never sends mail, use v=spf1 -all straight away so nobody can send as it.
Mistakes that break SPF
- Two SPF records. A domain must have exactly one TXT record starting with
v=spf1. Two make SPF fail with a permanent error for all your mail. Merge them into one. - More than 10 DNS lookups. Each
include,a,mx,existsandredirectcounts, including the ones nested inside includes. Over 10, SPF fails. Remove services you no longer use, and preferip4for your own servers. - Includes that point nowhere. A typo or a closed service leaves a lookup that returns nothing, which also counts against you. The checker flags these.
- Using +all. It allows the whole internet to send as you. Never use it.
- Expecting SPF to cover subdomains. Each subdomain that sends mail (for example
mail.yourdomain.com) needs its own record.
Frequently asked questions
Where do I add an SPF record?
In the DNS settings at whoever hosts your domain's DNS, which may be your registrar, Cloudflare or your web host. Add a TXT record with host @ (the root of the domain) and the record as the value. Your email provider doesn't add it for you.
Can I have two SPF records?
No. Two records make SPF fail for every message. Put all your senders into one record, for example v=spf1 include:_spf.google.com include:spf.protection.outlook.com ~all.
How long does an SPF record take to work?
Often minutes, but Google says up to 48 hours, depending on your DNS host and the record's TTL. Check it with the deliverability checker before you change anything else.
Do I still need DKIM and DMARC?
Yes. SPF breaks when mail is forwarded, and it checks a hidden sender address, not the From address people see. DKIM signs each message, and DMARC ties both to your visible From domain. Set up DKIM in your provider's admin, then add DMARC with the DMARC record generator.


