Office 365 SPF Record: How to Set It Up (With Examples)

SPFOffice 365 SPF Record: How to Set It Up (With Examples)

This guide walks you through the Office 365 SPF setup. By the end you'll have one SPF TXT record for your domain that authorizes Microsoft 365, plus any other service that sends for you. You need access to your DNS host (your registrar or DNS provider, not the Microsoft 365 admin center) and a list of the services that send email for your domain.

Microsoft now calls the product Microsoft 365, but SPF in Office 365 and in Microsoft 365 is the same record. All Microsoft values below come from Microsoft's SPF setup page, checked in November 2026.

Short answer

What is the SPF record for Office 365? For most organizations, it's a TXT record on your domain that includes spf.protection.outlook.com:

  1. Find every service that sends email for your domain: Microsoft 365, your own mail servers, and marketing, CRM or support tools.
  2. Publish one TXT record that starts with v=spf1 and includes include:spf.protection.outlook.com (commercial and GCC clouds).
  3. End it with -all, which Microsoft recommends, or with ~all while you're still taking stock of your senders.
  4. Don't publish a second SPF record. If you already have one, merge the new include into it.
  5. Check it with a DNS lookup or a free checker.

If Microsoft 365 is the only service that sends for your domain, this is the whole record:

v=spf1 include:spf.protection.outlook.com -all

Office 365 SPF record: the value to publish

The include depends on the Microsoft cloud your organization uses. Microsoft lists these records for domains that send only through Microsoft 365:

Microsoft cloud SPF record
Commercial 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 only send from your onmicrosoft.com address and have no custom domain, there's nothing to do. Microsoft already publishes SPF for that domain, and you can't change it.

Step 1: List what sends email for your domain

The SPF record for Office 365 has to cover everything that sends as your domain, not only Microsoft 365. Before you touch DNS, write down:

  • Microsoft 365 itself.
  • On-premises or hybrid mail servers you run.
  • Other services that send with your domain in the address: newsletter and marketing tools, your CRM, the helpdesk, billing or app notifications.

In larger organizations it's easy to miss a sender. Microsoft suggests setting up DKIM and a DMARC record at p=none with reporting, then using the reports to find the services that send for you. Our post on what DMARC is and why you should use it explains how those reports work.

Step 2: Add the record at your DNS host

Microsoft 365 has no admin portal setting or PowerShell command for SPF on your own domain. You create the TXT record where your domain's DNS is hosted, usually your registrar or DNS provider.

How to add the SPF record for Office 365:

  1. Sign in to your DNS host and open the DNS records for your domain.
  2. Create a record of type TXT for the domain itself. Many hosts write the root domain as @, but check your host's help pages.
  3. Paste your SPF record as the value, for example v=spf1 include:spf.protection.outlook.com -all.
  4. Set the TTL to at least 3600 seconds (one hour), as Microsoft advises.
  5. Save the record.

The exact buttons differ from host to host. Microsoft's guide to adding DNS records at any DNS hosting provider has the general steps; your host's own help pages have the specifics.

Already have an SPF record? Merge, don't add

This is where most Office 365 SPF problems start. A domain can have only one SPF record. If you publish multiple SPF records, SPF checks return a permanent error (permerror) and SPF fails for your domain. To combine SPF records in Office 365, you add Microsoft's include to the record you already have.

Say your domain already has this record:

v=spf1 include:_spf.google.com -all

Don't publish v=spf1 include:spf.protection.outlook.com -all next to it, and don't overwrite it, or the first sender loses its authorization. Edit the existing record so it holds both includes:

v=spf1 include:spf.protection.outlook.com include:_spf.google.com -all

Two separate DNS records being combined into a single SPF record

The same rule applies when a newsletter tool asks you to "add an SPF record": add its include: to your one record. The values here are examples; use the exact include each service gives you. For the full list of mechanisms and qualifiers, read Sender Policy Framework (SPF) explained.

Third-party senders: use a subdomain

Microsoft recommends sending bulk or marketing mail from services you don't control on a subdomain, such as marketing.contoso.com, instead of your main domain. That keeps the main record short and keeps another company's servers out of it.

Each subdomain needs its own SPF record. The record on contoso.com doesn't cover marketing.contoso.com. So if your marketing service sends as marketing.contoso.com, publish a TXT record on that subdomain with the include your service gives you:

marketing.contoso.com  TXT  "v=spf1 include:<include-from-your-service> -all"

Your main domain keeps its Microsoft 365 record:

contoso.com  TXT  "v=spf1 include:spf.protection.outlook.com -all"

Exchange hybrid and on-premises servers

For an Office 365 hybrid setup, the SPF record also has to list the on-premises servers that send mail directly to the internet. Microsoft notes that IP addresses in the record are usually only needed for these servers. Add each one with ip4: (or ip6:), next to the Microsoft include. Microsoft's example:

v=spf1 ip4:192.168.0.10 include:spf.protection.outlook.com -all

Replace the address with the one your own server sends from. ip4 and ip6 entries don't count toward the DNS lookup limit described below.

-all or ~all?

The last part of the record tells receivers how to treat servers you haven't listed. This is the "hard fail vs soft fail" question for Office 365:

  • -all (hard fail): unlisted servers aren't allowed to send for your domain. Microsoft recommends -all for Microsoft 365 domains, because it also recommends DKIM and DMARC, which handle the cases where SPF alone falls short.
  • ~all (soft fail): messages from unlisted servers are accepted but marked. Microsoft notes that when such a message has no DKIM signature, DMARC effectively ignores the ~all SPF failure, so your DMARC policy does less.
  • ?all (neutral): for testing only. Microsoft doesn't recommend it in production.

Our advice, not a rule: if you aren't sure every sender is in the record yet, use ~all while you take stock, then switch to -all.

Check that it works

DNS changes can take a while to show up. Once they have, use any of these to run an Office 365 SPF record check.

Our free checker. Open the SPF, DKIM and DMARC checker, enter your domain and click Check Domain. The SPF card shows Pass, Warning or Fail with the issues found, and Show raw record displays the record as it's published, so you can compare it with what you meant to publish.

A DNS lookup. On macOS or Linux, run:

dig +short TXT yourdomain.com

Replace yourdomain.com with your domain. The output lists all TXT records on the domain. Look for the line that starts with "v=spf1; there should be exactly one:

"v=spf1 include:spf.protection.outlook.com -all"

If you see two lines starting with "v=spf1, merge them as shown above. If you see none, the record isn't published yet or went on the wrong host name.

Microsoft's own tool. The Microsoft Remote Connectivity Analyzer can also validate your SPF record.

A test message. Send an email from Microsoft 365 to a mailbox you can read, open the message headers, and find the Authentication-Results header. A working record shows spf=pass, for example:

Authentication-Results: spf=pass (sender IP is 192.0.2.10) smtp.mailfrom=contoso.com; dkim=pass (signature was verified) header.d=contoso.com; dmarc=pass action=none header.from=contoso.com;

If you see spf=fail, spf=softfail, spf=permerror or spf=none instead, go to the troubleshooting section below. Microsoft's email authentication troubleshooting page explains each result.

Troubleshooting

SPF permerror in Office 365

A permerror means receivers can't evaluate your record at all. The two usual causes:

  • More than one SPF record. Two TXT records start with v=spf1. Merge them into one.
  • More than 10 DNS lookups. include, a, mx, exists and redirect each count as a lookup, and the includes inside an include count too. ip4, ip6 and all don't. Over 10, SPF returns permerror. The exact rules are in RFC 7208.

To get back under the limit, Microsoft suggests:

  • moving third-party senders to subdomains, each with its own record;
  • replacing a vendor's include with ip4: entries, if that vendor's addresses are stable;
  • removing services you no longer use, or sending through fewer services.

Typos

Small syntax errors also break the record. Microsoft lists these:

Mistake Wrong Right
Period after the domain name v=spf1 include:spf.protection.outlook.com. -all v=spf1 include:spf.protection.outlook.com -all
= instead of : v=spf1 include=spf.protection.outlook.com -all v=spf1 include:spf.protection.outlook.com -all
Space after the colon v=spf1 include: spf.protection.outlook.com -all v=spf1 include:spf.protection.outlook.com -all

SPF fail or softfail after adding a new service

If mail from a newly added tool shows spf=fail or spf=softfail, that tool's servers aren't in your record yet. Add the include the service gives you to your one record, or move the service to a subdomain with its own record.

Don't flatten the Microsoft include

Some tools offer to "flatten" a record by replacing includes with the IP addresses they currently point to. Don't do this with include:spf.protection.outlook.com. Microsoft's sending addresses change, and Microsoft advises against replacing its include with fixed IPs.

SPF temperror in Office 365

A temperror is a temporary DNS problem: the receiver couldn't get an answer while looking up your record. Try the check again later. If it keeps happening, confirm with your DNS host that the record is published, and keep its TTL at 3600 seconds or more.

Forwarded mail fails SPF

When a message is forwarded, it arrives from the forwarder's server, which isn't in your record, so SPF fails. Microsoft calls this expected. You can't fix it in SPF; a DKIM signature, which can survive forwarding, is what keeps such mail passing DMARC.

SPF is only one third

SPF tells receivers which servers may send for your domain. DKIM signs each message, and DMARC tells receivers what to do when both fail. To see how they fit together, read SPF, DKIM and DMARC: how the three work together, then set up the other two in Microsoft 365 with Microsoft's guides for DKIM and DMARC.

Next step: check your domain

Check your SPF, DKIM and DMARC records free once your new record is live.

SPF protects your domain's reputation, and a clean list protects it too: try the free email verifier before your next send.

Join 1,000+ CompaniesImproving Email Deliverability

Start with 200 free validations. Upgrade only when you're ready.

No credit card required • Cancel anytime