A typical SPF record example is v=spf1 include:_spf.google.com ~all, published as a TXT record at the root of your domain. It says Google Workspace servers may send mail for the domain, and other senders should soft-fail. The exact record depends on every service that sends mail for you, and it must end with an all mechanism.
Key takeaways
- An SPF record is a TXT record starting with v=spf1 that lists every server allowed to send mail for your domain.
- Google Workspace uses include:_spf.google.com and Microsoft 365 uses include:spf.protection.outlook.com, combined in one record.
- RFC 7208 limits SPF to 10 DNS lookups per check, so extra includes can cause a permanent error and break delivery.
An SPF record is one short line of text in your DNS that answers a simple question for every receiving mail server: which servers are allowed to send email for your domain? Get it right and your mail is trusted. Get it wrong and legitimate email lands in spam, or spoofed email sails through in your name.
What is an SPF record?
An SPF record is a DNS TXT record that lists the hosts allowed to send mail for a domain. When a server receives your email, it looks up your SPF record and checks whether the sending IP address is on the list.
SPF stands for Sender Policy Framework, and it is defined in RFC 7208. The record always starts with v=spf1, followed by mechanisms that describe authorized senders, and it usually ends with an all mechanism that says what to do with everyone else.
SPF checks the envelope sender, also called the return-path, not the From address shown in an inbox. That distinction matters: SPF alone cannot stop an attacker from putting your domain in the visible From field, which is why it works best with DKIM and DMARC. Our guide to what DMARC is and how to set it up explains how the three fit together.
What does an SPF record example look like?
A basic SPF record example for a domain that sends mail through Google Workspace is v=spf1 include:_spf.google.com ~all. It authorizes Google's servers and soft-fails everything else.
Published in DNS, the record looks like this:
- Type: TXT
- Host: @ (the root of your domain)
- Value:
v=spf1 include:_spf.google.com ~all - TTL: 3600 seconds is a common choice
Here is the same record broken down piece by piece:
That one line is the most common SPF record on the internet, but it is only correct if Google Workspace is your only sender. Most businesses also send from a website, a CRM, or a marketing tool, and every one of those senders belongs in the same record.
What are common SPF record examples by provider?
Each email provider publishes the include its customers should use. You copy that include into your single SPF record, and you never publish a separate SPF record per provider.
| Provider | SPF record example | Notes |
|---|---|---|
| Google Workspace | v=spf1 include:_spf.google.com ~all | Standard record for Gmail and Google Workspace mail. |
| Microsoft 365 | v=spf1 include:spf.protection.outlook.com ~all | Standard record for Exchange Online and Outlook mail. |
| SendGrid | v=spf1 include:sendgrid.net ~all | For transactional and marketing mail sent via SendGrid. |
| Postmark | v=spf1 include:spf.mtasv.net ~all | For transactional mail sent via Postmark. |
| Own mail server | v=spf1 ip4:192.0.2.1 ~all | Authorizes one fixed IP address; use your real server IP. |
| Multiple providers | v=spf1 include:_spf.google.com include:spf.mtasv.net ~all | Combine includes in one record, in any order. |
| No mail sent | v=spf1 -all | For domains that never send mail; rejects all senders. |
The provider examples above come from DNSimple's SPF setup guide, which lists the same includes for Google Workspace, Microsoft 365, SendGrid and Postmark. Always confirm the include on the provider's own documentation before publishing, because providers do change them.
A combined example for a small business that uses Google Workspace and sends invoices from its own server might look like this: v=spf1 ip4:192.0.2.1 include:_spf.google.com ~all. The ip4 mechanism costs no DNS lookup, while each include costs at least one, which brings us to the limit that catches many teams out.
How does SPF syntax work?
SPF syntax has three parts: the version tag, one or more mechanisms, and a final all mechanism. Receivers evaluate the mechanisms from left to right and stop at the first one that matches the sending IP address.
| Mechanism | Example | What it matches | DNS lookups |
|---|---|---|---|
ip4 | ip4:192.0.2.0/24 | An IPv4 address or range | 0 |
ip6 | ip6:2001:db8::/32 | An IPv6 address or range | 0 |
a | a or a:mail.example.com | The A or AAAA record of a domain | 1 |
mx | mx or mx:example.com | The MX hosts of a domain | 1 |
include | include:_spf.google.com | Senders in another domain's SPF record | 1, plus nested terms |
all | -all | Every sender not matched earlier | 0 |
Each mechanism can carry a qualifier in front of it. The default qualifier + means pass, - means fail, ~ means softfail, and ? means neutral. Most records only use a qualifier on the final all term, so ~all and -all are the two endings you will see most often.
Two modifiers also appear in SPF records. The redirect= modifier sends evaluation to another domain's record, which is useful when many domains share one policy. The exp= modifier points to a text explanation shown when a check fails. Avoid the ptr mechanism: RFC 7208 discourages it, and it is slow and unreliable.
What is the SPF 10 DNS lookup limit?
RFC 7208 limits SPF evaluation to 10 DNS-querying terms per check, including terms inside included records. If a record needs an eleventh lookup, receivers must return a permanent error, known as permerror.
That error is not a soft warning. Cloudflare's documentation notes that exceeding the limit can cause receiving servers to treat the SPF check as a permanent error and reject or flag your email. SPF also stops counting toward DMARC when it returns permerror, so mail that relied on SPF alignment starts to fail.
The lookup budget is easy to spend without noticing. Each include, a, mx, exists and redirect term costs one lookup, plus whatever the included record uses inside it. The ip4, ip6 and all mechanisms cost nothing, because the information is already in the record.
To stay under the limit, remove services you no longer use, move marketing mail to a subdomain with its own SPF record, and keep a small safety margin. A record that sits at 9 or 10 lookups breaks the next time a provider adds one.
How do I set up an SPF record step by step?
Setting up SPF takes four steps: list every sender, write one record, publish it as a TXT record, and test it. Do not skip the first step, because an unlisted sender is the most common cause of lost mail.
- List every sender. Check your mail provider, website contact forms, CRM, helpdesk, invoicing tool and marketing platform. Ask each one which SPF include or IP address it needs.
- Write one record. Start with
v=spf1, add each mechanism separated by a space, and end with~allwhile you test. Keep it under 255 characters per DNS string if your provider needs it. - Publish it as a TXT record. In your DNS panel, create a TXT record at the root of the domain with the record as its value. Delete any older SPF TXT record first, so only one exists.
- Test it. Run the domain through our free SPF checker to confirm the record resolves, counts the lookups, and parses without errors.
- Send test mail. Send messages from each sender to a test inbox and check the authentication results header for
spf=pass. - Tighten to -all. Once every sender passes for a week or two, change
~allto-allso unlisted senders fail instead of soft-failing.
If your DNS provider wraps TXT values in quotes, that is normal: the quotes are part of the DNS presentation format, not part of the SPF record itself. If you use a subdomain for bulk mail, such as news.example.com, that subdomain needs its own SPF record, because SPF is checked against the domain in the return-path.
How do I troubleshoot a failing SPF record?
Most SPF failures come from five causes: a missing sender, two records, too many lookups, a forwarding problem, or a typo. Work through them in that order.
- Missing sender: a service sends mail but is not in the record. Add its include or IP address, then retest.
- Two SPF records: delete one and merge its senders into the other. A lookup tool will flag this immediately.
- Too many lookups: count nested includes and remove dead services. Services that sign with DKIM in your domain can sometimes leave SPF entirely, because DMARC passes on aligned DKIM alone.
- Forwarding breaks SPF: when a mailbox forwards your mail, the forwarder's IP is not in your record, so SPF fails. DKIM survives forwarding better, which is another reason to publish both. See our guide to what DKIM is for the other half of the setup.
- Typos and spacing: a missing space, a wrong include domain, or a stray character invalidates the record. Copy the include exactly as the provider documents it.
When you read a bounce or a header, the result tells you what happened. Pass means the IP matched. Fail means it did not and the record ended in -all. Softfail means it did not match a ~all record. Permerror means the record itself is broken, often from too many lookups or a syntax error. None means no SPF record was found at all.
SPF vs DKIM vs DMARC: what is the difference?
SPF, DKIM and DMARC are three separate checks that work as a team. SPF authorizes the sending server, DKIM proves the message was not altered, and DMARC tells receivers what to do when either check fails.
| Check | What it proves | What it needs | Survives forwarding? |
|---|---|---|---|
| SPF | The sending IP is authorized | TXT record with sender list | No, often breaks |
| DKIM | The message was signed and unaltered | Public key in DNS, private key on sender | Usually yes |
| DMARC | SPF or DKIM aligns with the From domain | TXT record with a policy | Depends on DKIM |
DMARC is the policy layer: without it, a receiver that sees an SPF failure has no instruction from you about whether to reject the message. That is why the recommended path is SPF plus DKIM first, then DMARC at p=none to watch the reports, then p=quarantine, then p=reject. You can check your current setup with the free DMARC checker alongside the SPF checker.
For a fuller picture of the risks SPF helps prevent, see our spear phishing guide, which shows how attackers abuse domains without authentication. SPF is one layer, not the whole defense.
The bottom line
Start with one record that lists every real sender, test it, and tighten ~all to -all once you are confident. Keep the lookup count well under 10, and publish DKIM and DMARC alongside SPF so a single forwarding hop cannot undo your work.
Check your domain now with the free SPF checker to see your current record, its lookup count, and any errors before your next campaign goes out.
Frequently asked questions
What is an SPF record example?
A common SPF record example is v=spf1 include:_spf.google.com ~all. It is a TXT record published at the root of a domain. It says servers listed in Google's SPF record may send mail for the domain, and mail from other servers should soft-fail.
Where do I put an SPF record?
Publish it as a TXT record at the root of your domain, usually with a blank or @ host name in your DNS provider's panel. Do not use the old dedicated SPF record type, which RFC 7208 deprecated. Only one SPF record per domain is allowed.
What is the difference between ~all and -all in SPF?
The tilde in ~all means softfail: mail from unlisted servers is accepted but marked suspicious. The hyphen in -all means fail: unlisted servers should be rejected. Start with ~all while testing, then move to -all once you are sure every sender is listed.
How many DNS lookups can an SPF record use?
RFC 7208 limits SPF evaluation to 10 DNS-querying terms, including nested includes. If the limit is exceeded, receivers return a permanent error. Terms such as ip4, ip6 and all do not count toward the limit.
Can I have two SPF records for one domain?
No. A domain must have exactly one SPF record. If you publish two TXT records starting with v=spf1, receivers treat it as a permanent error. Combine every sender into a single record instead.
Does SPF stop phishing on its own?
No. SPF only checks the envelope sender's IP address, and it does not protect the From address your readers see. Pair SPF with DKIM and DMARC at p=reject so receivers can reject mail that fails authentication for your visible domain.
How long does an SPF record take to work?
DNS changes usually spread within minutes to a few hours, depending on the record's TTL and resolver caching. Test with an SPF checker after publishing, and send a test message to a mailbox that shows authentication results.
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 RFC 7208, Cloudflare's SPF lookup-limit documentation and DNSimple's SPF setup guide.
How we write and fact-check →