Guide

How to create an SPF record for your domain, and check it before publishing

Write the one line of DNS text that says who may send email as your domain, by hand or with our free builder, and catch the mistakes that break it.

An SPF record is one line of text in your domain's DNS settings. It lists the services and servers allowed to send email as your domain. To create one, list everything that sends mail for you, write a line that starts with v=spf1 and names each sender, and add it as a TXT record where your domain is managed.

If you only use Google Workspace, the whole record is v=spf1 include:_spf.google.com ~all. If you only use Microsoft 365, it is v=spf1 include:spf.protection.outlook.com -all. Both lines come from the companies' own help pages.

Three steps of an SPF check: an email arrives saying it is from your domain, the receiving server looks up your SPF record in DNS, and the message passes if the sending server is on your list or fails if it is not.
The receiving server does the checking. Your only job is to keep the list right.

Most small offices send from more than one place, and that's where records go wrong. This guide shows how to write the record by hand, then how to build and check it with our free tool.

What is an SPF record, in plain words?

SPF stands for Sender Policy Framework. When your email arrives somewhere, the receiving mail server looks up your domain's SPF record. Then it checks whether the server that sent the message is on your list.

If it is, the message passes. If it isn't, the receiver treats the message with suspicion or turns it away. That makes it harder for a scammer to send fake invoices that seem to come from your address.

It also helps your real mail arrive. Gmail asks every sender to set up SPF or DKIM. Anyone who sends more than 5,000 messages a day to Gmail accounts has needed SPF, DKIM and DMARC since February 1, 2024, according to Google's sender guidelines.

What goes into an SPF record?

A record is read left to right. Each part is separated by a space.

PartWhat it means
v=spf1Always first. It says this is an SPF record.
include:"Also trust the senders this service lists." One for each email service you use.
ip4: and ip6:One address, or a range of addresses, of a server you run.
mxThe servers that receive your mail also send it.
aThe server your domain name points to sends mail.
~allSoft fail. Mail from anywhere else is probably not from you.
-allFail. Mail from anywhere else is not from you.

The ending is the part people ask about most. Google recommends ~all. Microsoft recommends -all, because it expects you to set up DKIM and DMARC too. If you're just starting, ~all is the gentler choice. A sender you forgot gets marked as doubtful, not flatly refused.

How do I create an SPF record by hand?

  1. List everything that sends email as your domain. Think past your mailbox: the newsletter service, the invoicing app, the help desk, the website's contact form, the office scanner.
  2. Open each service's help page and search it for "SPF". Copy the include: value it gives you. Don't guess it and don't copy it from a forum.
  3. Write v=spf1, then each include, then any ip4: or ip6: addresses of your own servers, then ~all or -all.
  4. Count the parts that make the receiver do a DNS lookup: every include:, a, mx, ptr, exists and redirect. You may have 10 at most. The lookups inside each include count too.
  5. Sign in where your domain's DNS is managed. That is usually the company you bought the domain from.
  6. Look for a TXT record that already starts with v=spf1. If there is one, edit it. Never add a second.
  7. If there is none, add a TXT record. Set the host or name to @ (some hosts want it left blank) and paste your line as the value.
  8. Save. Google says it can take up to 48 hours for SPF to start working.

Checked on December 3, 2026 against Google's "Set up SPF" page (updated December 2, 2026), Microsoft's "Set up SPF" page for Microsoft 365 (updated July 17, 2026) and RFC 7208, the SPF standard.

A record for an office that uses Microsoft 365 for mail and Mailgun for its website's messages would look like this:

v=spf1 include:spf.protection.outlook.com include:mailgun.org ~all

DNS screens differ from one company to the next. If yours has no field called "host" or "name", look for "record name" or "subdomain". If it offers a record type called SPF, pick TXT anyway. The standard says SPF records must be published as TXT.

How do I build one with our free tool?

Our SPF record builder is ours, it's free, and it needs no account. It does steps 3 and 4 for you.

The Build a record section of Xcelcor's SPF record builder, with a list of email services to tick and the include value each one adds.
Our SPF record builder: tick the services that send your email, and each one shows the include value it adds.
  1. Open the SPF record builder.
  2. Under Services that send your email, tick each service you use. The list has 14, including Google Workspace, Microsoft 365, Zoho Mail, Mailgun, SendGrid, Amazon SES, Postmark, Brevo, Zendesk and Salesforce.
  3. Under Your own servers, tick Your incoming mail servers send mail too or The server your domain name points to sends mail if either is true for you.
  4. Type any addresses of your own into IPv4 addresses or ranges or IPv6 addresses or ranges, one per line.
  5. Under Mail from anywhere else, choose ~all or -all.
  6. Press Build the record, then copy the line into your DNS as in steps 5 to 8 above.

Each service in the list shows the include value it adds and the date we last checked it on that service's help page. Some carry a note. SendGrid and Amazon SES, for example, only need an include in certain setups, and the note says which.

The builder counts the parts that need a DNS lookup. It reports an error when the record goes over 10 lookups or 450 characters, and it warns when an address range is very wide. The tool's page says nothing you type is stored.

How do I check an SPF record I already have?

On the same page, paste your record into Your SPF record under Check a record, then press Check the record. It reports unknown terms, repeated terms and bad addresses. Do this before you publish a record you wrote or edited by hand.

That check reads only the text you paste. To see what your domain publishes right now, use our SPF record checker. It looks the record up and counts the lookups inside each include as well.

You can also read the result in a real message. Send an email from your domain to another mailbox and open its full headers. Find the line that starts Authentication-Results and read the text after spf. It should say pass.

What can't the builder do?

It doesn't look anything up in DNS. So it can't see the record you have now, and it can't count the lookups hidden inside each include. A record can pass the builder and still go over 10 once it's live. Run the SPF record checker after you publish.

It doesn't publish the record. You paste the line into your DNS yourself.

It knows 14 services. For any other, get the include value from that service's help page and add it by hand.

It doesn't cover DKIM or DMARC. Our email security checker checks all three for a domain and grades the result A to F.

Which mistakes break an SPF record?

Two SPF records on one domain is the classic one. It often happens when a new service says "add this TXT record" and someone adds it next to the old one. The standard treats that as an error, and your mail fails SPF. Merge them into one line with a single v=spf1 at the start and a single ending.

Too many lookups is the other. Every new service adds an include, and nobody removes the old ones. Past 10, receivers return a permanent error and SPF fails for all your mail.

This isn't only a small-office problem. In our Email Security Index run of December 1, 2026, we checked 4,106 US banks. We found 248 with an SPF record over the 10-lookup limit and 110 with no SPF record at all. The Email Security Index has the full results.

We think the lesson there is simple. A record that was right on the day it was written goes wrong later, one added service at a time. Check yours again whenever you add or drop a service that sends email.

If you're over the limit, start by removing the includes for services you no longer use.

What about a domain that never sends email?

Give it a record too. Microsoft's guidance for a domain that sends no mail is v=spf1 -all. It tells receivers that nothing from that domain is real, so nobody can borrow a name you own but don't use.

What should I set up after SPF?

SPF is one of three records that work together. DKIM signs your messages, and DMARC tells receivers what to do when a message fails both checks. Your email service's help pages cover each of them.

More guides and news on this are on our email security page. If your office emails contracts or tax forms, see how to send documents securely through email.

Questions people ask

Can I have two SPF records on one domain?

No. A domain may publish only one SPF record. With two, receiving servers return a permanent error and your mail fails SPF. Merge them into one line that starts with a single v=spf1.

Should my SPF record end in ~all or -all?

Google recommends ~all (soft fail). Microsoft recommends -all (fail) for Microsoft 365 domains that also use DKIM and DMARC. If you're just starting, ~all is the gentler choice.

What is the SPF 10 lookup limit?

The SPF standard (RFC 7208) lets a record cause at most 10 DNS lookups. Every include, a, mx, ptr, exists and redirect counts, and so do the lookups inside each include. Past 10, SPF fails with a permanent error.

How long does a new SPF record take to work?

Google says it can take up to 48 hours for SPF to start working after you add or change the record.

Sources

Editorial review & fact-checking

This guide was reviewed and approved by Kevin Mercer, Head of Security Operations & Infrastructure at Xcelcor, on .

Our content is researched using publicly available sources and developed with AI assistance, with editorial review for accuracy, reliability and relevance.

Learn more about our editorial standards and review process. To report an error or suggest a correction, contact support@xcelcor.com.

More on Small business Email security