What is the Microsoft 365 SPF record?
The Microsoft 365 SPF record is v=spf1 include:spf.protection.outlook.com -all, published as one TXT record on each custom domain that sends through Exchange Online. It authorises Microsoft's outbound servers to send for the domain and hardfails everything else. Hybrid servers and other senders go into that same record, never a second one.
This guide, sometimes searched as the "Office 365 SPF record", takes the record apart term by term, counts what it costs against the 10 DNS lookup limit in RFC 7208, and covers Exchange hybrid, third-party senders, sovereign clouds and what DMARC (Domain-based Message Authentication, Reporting and Conformance) changes. It ends with a routine for MSPs (managed service providers) running many client tenants. For SPF (Sender Policy Framework) fundamentals, start with the SPF guide. The Google equivalent is in the Google Workspace SPF record explained.
Key takeaways
- Microsoft's recommended record for a domain that only sends through Microsoft 365 is
v=spf1 include:spf.protection.outlook.com -all, and Microsoft recommends-allbecause it also recommends DKIM and DMARC. - When we queried it on 14 November 2026,
spf.protection.outlook.comcontained onlyip4andip6ranges, so the include cost one DNS lookup. Recount it at every audit. - The
*.onmicrosoft.comdomain's SPF record is managed by Microsoft and cannot be edited. Custom domains and every sending subdomain need their own record. - Exchange Online uses your own domain in the envelope sender for normal user mail, so an SPF pass aligns for DMARC. DKIM is still needed, because forwarding breaks SPF.
Where does Microsoft document the record?
Microsoft's Set up SPF to help prevent spoofing article gives the value for the "Microsoft 365 email only" scenario: v=spf1 include:spf.protection.outlook.com -all. You publish it at the domain's DNS host, or in the Microsoft 365 admin center if Microsoft hosts the zone.
In zone file form, for a client domain:
clientco.co.uk. 3600 IN TXT "v=spf1 include:spf.protection.outlook.com -all"
Microsoft also recommends "a minimum TTL value of 3600 seconds (one hour) on SPF TXT records to avoid DNS lookup timeouts". Its own wording for when the include is needed is plain: "Most Microsoft 365 organizations require include:spf.protection.outlook.com in the SPF TXT record for the domain."
What does each part of the record mean?
The record has three terms: a version tag, one include mechanism and a closing all with the fail qualifier. A receiver evaluates them left to right and stops at the first mechanism that matches the connecting IP address.
| Term | Type | What it does | DNS lookups |
|---|---|---|---|
v=spf1 |
Version tag | Marks the TXT record as SPF. It must come first. | 0 |
include:spf.protection.outlook.com |
Mechanism | Evaluates Microsoft's published SPF record. If the sending IP passes there, it passes here. | 1, plus any lookups inside Microsoft's record |
-all |
Mechanism with - qualifier |
Matches every IP not listed earlier and returns fail. |
0 |
An include does not copy Microsoft's ranges into your record. It runs Microsoft's record and uses the result. Under RFC 7208, Section 5.2, an include that points at a name with no SPF record returns permerror, so a typo such as spf.protection.outlok.com breaks SPF for every sender on the domain. Microsoft lists two more syntax errors to watch for: an equals sign instead of a colon after include, and a trailing period after the domain name.
How many DNS lookups does spf.protection.outlook.com use?
When we resolved it through a public resolver on 14 November 2026, the include cost exactly one lookup. spf.protection.outlook.com returned a flat record of ip4 and ip6 ranges ending in -all, with no nested includes. That leaves nine lookups for everything else on the domain.
The limit comes from RFC 7208, Section 4.6.4: receivers "MUST limit the total number of those terms to 10 during SPF evaluation". Terms that count are include, a, mx, ptr, exists and redirect; ip4, ip6 and all do not. Microsoft adds a useful warning: "having fewer than 10 include: statements doesn't guarantee fewer than 10 DNS lookups", because nested includes count too. Above 10, SPF returns permerror.
Microsoft controls that record and can restructure it, so do not hard-code the count in a runbook. Check the live expansion with our SPF analyzer at each audit. If a client is already near the limit, SPF too many DNS lookups covers the fixes.
Does Microsoft recommend -all or ~all?
Microsoft recommends -all (hardfail) for Microsoft 365 domains. Its SPF article states: "For Microsoft 365 domains, we recommend -all (hard fail) because we also recommend DKIM and DMARC for the domain." It adds: "We recommend -all so DMARC can act on messages that fail SPF if the messages also lack DKIM signatures."
That differs from Google, which recommends ~all for Workspace. With DMARC at enforcement, the gap is small: DMARC only asks for an aligned pass, and fail and softfail are both "not pass". The practical risk of -all is a receiver rejecting forwarded mail on SPF alone before DKIM is checked, which RFC 9989 itself discusses. The full comparison is in SPF ~all vs -all with DMARC.
What about the onmicrosoft.com domain?
You do not publish SPF for it. Microsoft's article says that for the Microsoft Online Email Routing Address (MOERA) domain, such as contoso.onmicrosoft.com, "The SPF TXT record is already configured for you", and that "You can't modify the existing SPF TXT record for the *.onmicrosoft.com domain."
The MOERA domain still needs a DMARC record, which you add in the Microsoft 365 admin center. The steps are in the DMARC for Microsoft 365 implementation guide.
Which include do sovereign clouds use?
Government and China tenants use a different include. Microsoft documents these three values:
| Environment | SPF record |
|---|---|
| Microsoft 365 and GCC | v=spf1 include:spf.protection.outlook.com -all |
| GCC High and DoD | v=spf1 include:spf.protection.office365.us -all |
| Microsoft 365 operated by 21Vianet | v=spf1 include:spf.protection.partner.outlook.cn -all |
If you inherit a tenant in one of these clouds, confirm which environment it is in before touching DNS. Using the commercial include on a GCC High tenant leaves its real sending IPs unauthorised.
How do I add Exchange on-premises servers in a hybrid setup?
Add the public IP of any on-premises server that sends internet mail directly, using ip4 or ip6. Microsoft says you typically use IP addresses in the record "only if you have on-premises email servers that send mail from the Microsoft 365 domain (for example, Exchange Server hybrid deployments)". These terms cost no lookups.
Microsoft's hybrid example:
clientco.co.uk. 3600 IN TXT "v=spf1 ip4:192.0.2.10 include:spf.protection.outlook.com -all"
Check the routing before you add anything. If the on-premises server sends outbound mail through Exchange Online (for example, a smart host or centralised mail transport pointing at Microsoft 365), receivers see Microsoft's IPs and the include already covers it. An ip4 entry is only needed for the address that actually connects to external receivers. The same applies to scanners and line-of-business apps: if they relay through Exchange Online, no extra entry; if they send straight to the internet, their public IP goes in. Exchange Server on-premises cannot DKIM-sign natively, which matters for DMARC; DKIM for Exchange Server on-premises explains the options.
How do I add third-party senders?
Add their include to the same record, before the all, but only if they use your domain in the envelope sender. Microsoft notes that "Other non-Microsoft email services often require an additional include: value", and recommends "using a subdomain (for example, marketing.contoso.com) instead of your main email domain" for services you do not control.
Many email service providers (ESPs) and CRMs send with their own bounce domain in the envelope, so your apex record is never checked for that mail. An include there costs a lookup and adds no DMARC benefit. Aligned DKIM, or a custom return-path subdomain where the vendor supports one, is what makes that mail pass. The wider process is in how to handle third-party senders during DMARC projects.
What do worked examples look like?
Three common client shapes, with placeholder ESP and CRM includes. Always use the exact value each vendor documents.
Microsoft 365 only:
clientco.co.uk. 3600 IN TXT "v=spf1 include:spf.protection.outlook.com -all"
Lookups when checked: 1.
Microsoft 365 plus an on-premises relay sending directly:
clientco.co.uk. 3600 IN TXT "v=spf1 ip4:198.51.100.25 include:spf.protection.outlook.com -all"
Lookups when checked: 1, because ip4 is free.
Microsoft 365 plus an ESP on a subdomain and a CRM on the apex:
clientco.co.uk. 3600 IN TXT "v=spf1 include:spf.protection.outlook.com include:_spf.crm.example -all"
news.clientco.co.uk. 3600 IN TXT "v=spf1 include:_spf.esp.example -all"
The apex costs 1 plus whatever the CRM's record contains. The ESP's lookups count only against the subdomain, because each SPF record is evaluated on its own. That is one reason Microsoft suggests subdomains for bulk mail; subdomain or separate domain for bulk email weighs the choice.
Do subdomains need their own record?
Yes, if they send. Microsoft states: "the SPF TXT record for contoso.com doesn't cover marketing.contoso.com; marketing.contoso.com needs its own SPF TXT record." SPF is never inherited from the parent domain.
Parked domains and subdomains that never send should publish v=spf1 -all, which is also Microsoft's example for parked domains. DMARC handles subdomains differently, through inheritance and the sp and np tags; see DMARC for subdomains.
Does SPF align with DMARC for Microsoft 365 mail?
Yes, for normal user mail. SPF is checked against the envelope sender (the SMTP MAIL FROM, shown as Return-Path), and Exchange Online uses the user's own address there. So SPF passes for clientco.co.uk, which matches the visible From domain, and DMARC counts it as aligned.
Microsoft's anti-spam message headers page shows the field to check. A received test message should carry something like:
Authentication-Results: spf=pass (sender IP is 192.0.2.10) smtp.mailfrom=clientco.co.uk;
dkim=pass (signature was verified) header.d=clientco.co.uk;
dmarc=pass action=none header.from=clientco.co.uk;compauth=pass reason=100
SPF alone is not enough. Forwarding replaces the sending IP, so SPF fails at the next hop, and only DKIM survives. Microsoft does not sign with your custom domain until you set up DKIM, so check the header.d value. DMARC and email forwarding explains the mechanics.
How does Microsoft 365 treat SPF failures with DMARC?
Microsoft does not act on SPF alone. Its composite authentication result (compauth) combines SPF, DKIM, DMARC and other signals, based on the From domain. A DMARC fail with p=quarantine or p=reject gives compauth=fail reason=000, and Microsoft applies the policy action set in its anti-phishing policy.
Two details matter for your own domains. Reason 001 means implicit authentication failed because the domain had no records or "a weaker failure policy (SPF ~all or ?all, or a DMARC policy of p=none)". And for outbound mail, Microsoft routes messages that fail DMARC at the destination through its high-risk delivery pool when the domain is at p=quarantine or p=reject, with "no override". A broken SPF record therefore hurts deliverability as well as inbound checks. DMARC and Microsoft Defender goes deeper into the anti-phishing settings.
How do I check the record?
Query the TXT records and confirm there is exactly one starting with v=spf1. In PowerShell:
Resolve-DnsName -Name clientco.co.uk -Type TXT | Where-Object { $_.Strings -match '^v=spf1' }
Resolve-DnsName -Name spf.protection.outlook.com -Type TXT
With dig:
dig +short TXT clientco.co.uk
dig +short TXT spf.protection.outlook.com
The second query in each pair shows what Microsoft's include currently expands to. Then send a test message to an external mailbox and read Authentication-Results, or paste it into the email header analyzer. Microsoft's troubleshooting page also points to its Remote Connectivity Analyzer for validating SPF.
What are the most common Microsoft 365 SPF mistakes?
Most failures come from inherited records. Check these on every new tenant.
| Mistake | Example | Effect | Fix |
|---|---|---|---|
| Two SPF records | One for Microsoft 365, one for an ESP | permerror for all mail |
Merge into one record |
| Missing include | Only ip4 entries from an old host |
Exchange Online mail fails SPF | Add include:spf.protection.outlook.com |
| Legacy include | include:outlook.com |
Does not match Microsoft's documented include | Replace with include:spf.protection.outlook.com |
| Lookup overflow | Eight vendor includes on top of Microsoft | permerror once over 10 |
Remove dead senders, move bulk mail to subdomains |
+all |
v=spf1 include:spf.protection.outlook.com +all |
Any IP on the internet passes | End with -all |
ptr mechanism |
v=spf1 ptr include:spf.protection.outlook.com -all |
Slow, unreliable, costs a lookup | Remove it |
Text after all |
-all include:_spf.crm.example |
Later terms never evaluated | Move all to the end |
| Wrong cloud include | Commercial include on a GCC High tenant | Real sending IPs unauthorised | Use the documented sovereign include |
On include:outlook.com: when we checked on 14 November 2026, it resolved to a smaller set of ranges than spf.protection.outlook.com, so it is not a substitute. On ptr, RFC 7208, Section 5.5 says the mechanism "SHOULD NOT be published". For merging duplicates step by step, see multiple SPF records.
What should an MSP check across Microsoft 365 clients?
Run the same audit for every tenant at onboarding and at each quarterly review, and put SPF changes through normal change control with a rollback value recorded.
- List every accepted domain in the tenant and confirm each sending domain has exactly one SPF record.
- Confirm the right include for the tenant's cloud, spelt correctly.
- Count lookups live rather than trusting a runbook figure.
- Map hybrid routing. Note which on-premises servers, scanners and apps send directly, and which relay through Exchange Online.
- Match the record to DMARC aggregate reports. Each include should match a source you can see, and each legitimate source should pass SPF or aligned DKIM.
- Check DKIM is enabled for every custom domain and test
header.d. - Publish
v=spf1 -allon parked domains and non-sending subdomains. - Record why each include exists, so the next engineer can remove dead ones safely.
The UK NCSC's email security guidance covers SPF, DKIM and DMARC as one set, which is a useful reference when explaining the work to a client. The DMARC for MSPs page shows how the reporting side fits a portfolio.
FAQ
Is the Office 365 SPF record different from the Microsoft 365 one?
No. Office 365 and Microsoft 365 use the same Exchange Online service and the same include, include:spf.protection.outlook.com, for commercial and GCC tenants. Only GCC High, DoD and 21Vianet tenants use different includes, which Microsoft documents separately. The record format and the single-record rule are the same everywhere.
Can I use ~all instead of -all with Microsoft 365?
You can, and DMARC treats both as "not pass". Microsoft recommends -all because it expects DKIM and DMARC alongside SPF. Microsoft's composite authentication also treats ~all as a weaker failure policy. Use -all once every legitimate sender is in the record and DKIM is enabled for the domain.
Do I need an SPF record if DKIM is enabled in Microsoft 365?
Yes. Microsoft tells you to configure SPF and DKIM for every custom domain before DMARC. SPF gives DMARC a second aligned path if a DKIM signature breaks or a key is misconfigured, and some senders, such as directly connected on-premises servers, may only have SPF.
How many DNS lookups does the Microsoft 365 SPF include use?
When we checked on 14 November 2026, include:spf.protection.outlook.com used one lookup, because Microsoft's record contained only ip4 and ip6 ranges. Microsoft can change that record without notice, so recount it with an SPF checker that expands nested includes whenever you audit a client domain.
Next steps
Pull the SPF record for each Microsoft 365 client, confirm there is one record with the correct include and a single -all, and count the lookups live. Then confirm DKIM signing with the client's own domain, because SPF does not survive forwarding. DMARC aggregate reports show which sources pass SPF for each client domain; DMARC AI processes those reports across client tenants and highlights sources that fail SPF or alignment.