To add an SPF record to DNS, list every service that sends email as your domain, build one TXT record starting with v=spf1 and ending with ~all or -all, publish it at your DNS host with host @ and type TXT, then verify it with an SPF checker. For Google Workspace only, use v=spf1 include:_spf.google.com ~all; for Microsoft 365 only, use v=spf1 include:spf.protection.outlook.com -all.
Key takeaways
- SPF is one TXT record at the root of your domain — never create a second one, or SPF returns a permerror.
- List every sender first, including marketing and transactional services, or their mail will start failing SPF.
- SPF alone does not stop spoofing of the visible From address — add DKIM and DMARC after SPF passes.
If your emails land in spam, or anyone can send mail that looks like it came from you, a missing or broken SPF record is often the cause. Adding one takes minutes — if you list every sender first and publish exactly one record.
What is an SPF record?
SPF, or Sender Policy Framework, is a DNS TXT record that publishes which mail servers are allowed to send email for your domain. Receiving servers check it when mail arrives.
When a server receives mail claiming to be from your domain, it looks up your SPF record and compares the sending server against your list. If the server is listed, SPF passes. If it is not listed, the result depends on the ending you chose, usually a soft fail or a hard fail.
SPF is defined in RFC 7208. Google's SPF setup guidance explains the same steps for Google Workspace, and Microsoft Learn's SPF guidance covers Microsoft 365. It is one of three email authentication standards, alongside DKIM and DMARC, and it is the first one most small businesses should publish. Our guide to what DMARC is explains how the three fit together.
What do I need before adding an SPF record?
Before you touch DNS, list every service that sends email as your domain. This step is where most SPF setups go wrong, because a forgotten sender starts failing after you publish.
- Your mailbox provider: Google Workspace or Microsoft 365.
- Transactional email: SendGrid, Amazon SES, Postmark, Mailgun or your own server.
- Marketing email: Mailchimp, HubSpot, Brevo or similar.
- Helpdesk and CRM: Zendesk, Salesforce, or any system that emails customers as you.
- Billing and invoicing: accounting software that sends invoices from your domain.
- Your website: contact forms and password-reset emails sent from your server.
Check your existing DNS too. Look for a TXT record whose value starts with v=spf1. If one exists, you will edit it, not add a second one. You can check your current records with our free SPF checker before you start.
How do I build the SPF record?
An SPF record is a single line of text. It starts with v=spf1, lists your authorized senders, and ends with an all mechanism that decides what happens to everyone else.
| Part | Meaning | Example |
|---|---|---|
| v=spf1 | Required version tag, always first | v=spf1 |
| include: | Authorize another domain's senders | include:_spf.google.com |
| ip4: / ip6: | Authorize a specific IP or range | ip4:203.0.113.25 |
| ~all | Soft fail: not listed, treat as suspicious | ~all |
| -all | Hard fail: not listed, reject | -all |
Ready-to-use examples, taken from the providers' own guidance:
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:
v=spf1 include:_spf.google.com include:spf.protection.outlook.com ~all
Google Workspace + SendGrid:
v=spf1 include:_spf.google.com include:sendgrid.net ~all
Domain that sends no mail:
v=spf1 -all
For every other service, use the include value from that service's own documentation, not from a blog post. Providers change their includes, and a copied value from an old article can silently break your mail.
Should I end my SPF record with ~all or -all?
The ending decides what receiving servers do with mail from servers not on your list. ~all means soft fail: the sender is probably not authorized, but the message can still be delivered. -all means hard fail: the sender is not authorized.
Google recommends ~all for Google Workspace, and Microsoft recommends -all for domains that only send through Microsoft 365. The providers disagree because -all is stricter and can reject legitimate mail if your list is incomplete, while ~all is safer during setup.
A practical rule: start with ~all while you confirm every sender is listed, then move to -all once you are confident, especially if you also publish DMARC. A domain that sends no mail at all should publish v=spf1 -all, which authorizes nobody.
How do I add the SPF record to DNS?
The record is identical everywhere; only the form differs. Go to your DNS host, not your mailbox provider. That is the company that runs your domain's name servers — often your registrar, Cloudflare, or your hosting provider.
- Sign in to your DNS host and open the DNS records page for your domain.
- Check for an existing SPF record. Look for a TXT record starting with
v=spf1. If one exists, edit it. Never add a second one. - Add or edit a TXT record with these fields: Type
TXT, Host or Name@for the root domain, Value the full SPF record. - Set the TTL. A TTL of 3600 seconds (one hour) is a common choice. Many hosts default to one hour or less.
- Save the record. Some panels add quotes around the value for you; do not add a second pair of quotes yourself.
Where to find the form depends on the host. At Cloudflare it is DNS, then Records, then Add record, with Type TXT, Name @ and Content the full record. At GoDaddy and Namecheap the same fields appear under DNS management, with the host field usually @ or left blank.
What is the 10 DNS lookup limit?
RFC 7208 limits SPF evaluation to 10 DNS lookups. Each include: usually costs at least one lookup, and some providers' includes trigger several more behind the scenes.
If your record exceeds 10 lookups, SPF returns a permerror and receiving servers cannot verify your mail. This is a common problem for domains that added a new marketing tool every year without ever cleaning up the record.
Keep the count down by removing services you no longer use, replacing an include: with an ip4: address where the sender has a fixed IP, or using an SPF flattening service. Count the lookups with an SPF checker after every change, not just when you first publish.
How do I verify my SPF record works?
Wait for DNS to propagate, then check from outside your own network. Google says changes can take up to 48 hours, though they are usually visible much faster.
- Run an SPF checker on your domain. Confirm the record parses, there is only one SPF record, and the lookup count is under 10.
- Send a test email from your mailbox to a personal Gmail address.
- Open the message in Gmail, choose Show original, and look for
SPF: PASSin the authentication results. - Test every sender, not just your mailbox. Send a test from your marketing platform, your helpdesk and your website form too.
If SPF fails, check the usual causes first: a second SPF record, a typo in an include, a sender you forgot to list, or a lookup count over 10. Our SPF checker shows the parsed record and lookup count in one view.
What are the common SPF mistakes?
Most broken SPF records fail for one of a handful of reasons. Check this list before you assume the record needs a redesign.
- Two SPF records. The most common error. Merge them into one record.
- A forgotten sender. A marketing tool or invoice system that was never added to the list.
- Too many lookups. More than 10 DNS lookups, usually from stacked includes.
- Wrong host field. Publishing the record on a subdomain instead of the root domain, or vice versa.
- Double quotes. Adding quotes that your DNS panel already adds for you.
- SPF on the wrong domain. Adding the record where you bought the domain instead of where DNS is actually hosted.
- Thinking SPF is enough. SPF checks the envelope sender, not the visible From address, so it cannot stop spoofing alone.
If mail still fails after you fix these, check whether the failing mail uses a different envelope domain, such as a subdomain or a third-party bounce domain. SPF is checked against that domain, not the one in the From header.
What comes after SPF: DKIM and DMARC?
SPF alone does not stop spoofing, because it checks the envelope sender, not the From address a recipient sees. An attacker can pass SPF with their own domain while displaying your address in From.
DKIM adds a cryptographic signature to each message, so receivers can verify the message was not altered in transit. DMARC ties SPF and DKIM to the visible From domain and tells receivers what to do with mail that fails either check.
The safe order is SPF first, then DKIM, then DMARC at p=none to monitor, then p=quarantine, then p=reject. Our guide to what DKIM is walks through the next step.
Then read our guide to what DMARC is for the final step, which ties SPF and DKIM to the visible From domain.
You can also check all three at once with our free email security score, and RFC 7208 sets out the single-record rule and the 10-lookup limit in full.
The bottom line
Adding an SPF record is a small DNS change with a large effect on deliverability and impersonation risk. List every sender, build one record, publish it as a TXT record at your DNS host, and verify it passes.
Then do not stop there. Add DKIM and DMARC, and re-check your records whenever you add a new email service. You can verify your domain in seconds with our free SPF checker.
Frequently asked questions
What is an SPF record?
An SPF record is a TXT record in DNS that lists which mail servers are allowed to send email for your domain. Receiving servers check it when mail arrives and compare the sending server against your list.
Where do I add an SPF record?
At your DNS host, the company that runs your domain's name servers. That is often your registrar, Cloudflare, or your hosting provider. You add a TXT record at the root of the domain, usually with host @.
What is the SPF record for Google Workspace?
For Google Workspace only, it is v=spf1 include:_spf.google.com ~all. If you also send through other services, add their include values to the same record before the ~all at the end.
What is the SPF record for Microsoft 365?
For Microsoft 365 only, Microsoft recommends v=spf1 include:spf.protection.outlook.com -all. The -all ending means any server not on your list fails SPF, which is stricter than Google's ~all.
Can I have more than one SPF record?
No. RFC 7208 allows only one SPF record per domain name. If you publish two, receiving servers return a permerror and SPF effectively fails. Edit the existing record instead of adding a second one.
How long does an SPF record take to work?
Google says it can take up to 48 hours for SPF to start working, though it is usually much faster. The delay depends on the TTL you set and how long receiving servers cache DNS records.
What is the 10 DNS lookup limit in SPF?
RFC 7208 limits SPF evaluation to 10 DNS lookups. Each include usually costs at least one lookup, and some providers' includes trigger more. If you exceed 10, SPF returns a permerror, so keep the record short or flatten includes.
Does SPF stop email spoofing?
Not on its own. SPF checks the envelope sender, not the From address a recipient sees. An attacker can pass SPF with their own domain while displaying your address in From. That is why you also need DKIM and DMARC.
Sources
The engineers and analysts who build Cysoro's domain scanner, email-authentication checks and free security tools. We test what we write about every day — SPF, DKIM, DMARC, certificates, look-alike domains and phishing — and check each guide against the relevant standards, government guidance and vendor documentation.
Checked against Google Workspace Admin Help, Microsoft Learn's SPF setup guidance and RFC 7208.
How we write and fact-check →