The exact SPF record
Copy the example that matches your setup. Each one is a single TXT record; the host is shown as your DNS provider usually expects it (@ means the domain itself).
Microsoft 365 only
Type: TXT · Host: @ · 1 of 10 DNS lookups
v=spf1 include:spf.protection.outlook.com -all
Microsoft 365 and Google Workspace (for example during a migration)
Type: TXT · Host: @ · 2 of 10 DNS lookups
v=spf1 include:spf.protection.outlook.com include:_spf.google.com -all
Microsoft 365 and your own on-premises server (Exchange hybrid)
Type: TXT · Host: @ · 1 of 10 DNS lookups
v=spf1 ip4:203.0.113.10 include:spf.protection.outlook.com -all
Replace 203.0.113.10 with the public IP address your server sends from.
GCC High and DoD tenants
Type: TXT · Host: @ · 1 of 10 DNS lookups
v=spf1 include:spf.protection.office365.us -all
Microsoft 365 operated by 21Vianet
Type: TXT · Host: @ · 2 of 10 DNS lookups
v=spf1 include:spf.protection.partner.outlook.cn -all
How SPF applies to Microsoft 365 mail
Receivers check SPF against the domain in the envelope sender (the MAIL FROM or bounce address). Microsoft 365 sends with your own domain there, so its include belongs in the SPF record on the domain you send from.
- Your
onmicrosoft.comdomain needs nothing: Microsoft publishes and maintains its SPF record, and you can't change it. - Each subdomain you send from needs its own SPF record. The record on
contoso.comdoesn't covermarketing.contoso.com. - Microsoft advises against replacing its include with IP addresses ("flattening"), because its sending addresses change often.
How to add it
- Sign in to the company that hosts your DNS (often your domain registrar). There is no SPF setting inside Microsoft 365 itself.
- Look for an existing TXT record on the domain (host
@) that starts withv=spf1. - If there is one, add
include:spf.protection.outlook.comto it, right afterv=spf1. If there isn't, create a TXT record with the value for your cloud above. - Microsoft recommends a TTL of at least 3600 seconds (one hour) for the SPF record.
- Save, wait for DNS to update, then check the live record with the SPF Checker below.
DKIM and DMARC alignment
Microsoft says SPF alone is not enough and recommends DKIM and DMARC for every custom domain. It recommends -all because DMARC then decides what happens to failing mail, and notes that with ~all the DMARC policy is effectively ignored for messages that fail SPF and have no DKIM signature. Turn on DKIM signing for your domain (see our DKIM setup guide for Microsoft 365 and Google Workspace), then publish a DMARC record.
DMARC passes when SPF or DKIM passes and the domain it checked matches your From domain. Our guide to SPF, DKIM and DMARC explains how the three fit together.
Common mistakes
- Two SPF records. A domain may publish only one record that starts with
v=spf1. With two, receivers return a permanent error and SPF fails for all your mail (RFC 7208 section 3.2). Merge every sender into one record. - More than 10 DNS lookups. Each
include,a,mx,existsandredirectcosts a lookup, nested ones included; over 10 is a PermError (section 4.6.4). Microsoft 365's include costs 1 on its own. See how to fix too many SPF lookups. - Choosing
~allor-allwithout a plan. Microsoft 365's documentation uses-all.-allasks receivers to reject unlisted servers;~allasks them to accept but mark the mail. Once DMARC is enforced, receivers act on DMARC instead. Read SPF soft fail vs hard fail before you choose. - Common syntax errors Microsoft lists: a trailing period (
include:spf.protection.outlook.com.), an equals sign instead of a colon (include=), and a space after the colon.
Check your SPF record
See your live record, every nested include and the real lookup count. Free, reads public DNS only.
Building a new record? Open the SPF Record Generator with Microsoft 365 filled in.
Frequently asked questions
What is the SPF record for Microsoft 365?
For the worldwide service and GCC, it is v=spf1 include:spf.protection.outlook.com -all, published as a TXT record on your custom domain. If other services send mail as your domain, add their includes to the same record instead of creating a second one.
Should Microsoft 365 use -all or ~all?
Microsoft recommends -all (hard fail) for Microsoft 365 domains, together with DKIM and DMARC. Its reasoning: DMARC treats both as SPF failures, but with ~all the DMARC policy is effectively ignored for messages that also lack a DKIM signature. Our soft fail vs hard fail guide covers the trade-offs.
Is the Office 365 SPF record the same?
Yes. Microsoft renamed most Office 365 plans to Microsoft 365, and Exchange Online still sends the mail, so guides that mention the Office 365 SPF record give the same value: v=spf1 include:spf.protection.outlook.com -all. Only GCC High, DoD and 21Vianet tenants use a different include, shown above.
Do I need an SPF record for my onmicrosoft.com domain?
No. Microsoft owns onmicrosoft.com, so it creates and maintains the SPF record for your contoso.onmicrosoft.com domain. You only publish SPF for custom domains you add to Microsoft 365.
Sources
- Microsoft Learn: Set up SPF to identify valid email sources for your Microsoft 365 domain
- RFC 7208: Sender Policy Framework (SPF)
Values checked against Microsoft 365's documentation on October 9, 2026. Lookup counts measured with our SPF Checker on October 9, 2026; providers change their records, so check yours before relying on a number.
SPF records for other providers
- Google Workspaceinclude:_spf.google.com
- Zoho Mailinclude:zoho.com
- GoDaddyinclude:secureserver.net
- Fastmailinclude:spf.messagingengine.com
- Proton Mailinclude:_spf.protonmail.ch
- Amazon SESinclude:amazonses.com
- SendGridinclude:sendgrid.net
- Mailguninclude:mailgun.org
- PostmarkNone needed
- MailchimpNone needed
- BrevoNone for standard sending; spf.brevo.com with a dedicated IP
- HubSpotAccount-specific (copy from HubSpot)
- KlaviyoNone needed
- Salesforceinclude:_spf.salesforce.com
- Zendeskinclude:mail.zendesk.com
- Freshdeskinclude:email.freshdesk.com
- IntercomNone needed
Related guides
SPF record syntax and examples
SPF record syntax explained: mechanisms, qualifiers and modifiers, with copy-ready examples for Microsoft 365, Google Workspace, subdomains and parked domains.
9 min read SPF, DKIM & DMARCHow to fix SPF PermError: too many DNS lookups
Why SPF breaks at 10 DNS lookups, how to count them, and step-by-step fixes for Microsoft 365 and Google Workspace domains with many senders.
8 min read SPF, DKIM & DMARCSPF softfail vs hardfail: should you use ~all or -all?
What ~all, -all and ?all mean in SPF, what receivers really do with each, how DMARC changes the choice, and which one to use for sending and parked domains.
8 min readLast updated