SPF Record Guide: What It Is and How to Set It Up
Learn what an SPF record is, why it prevents your emails from going to spam, and how to create and publish one for your domain.
If your emails are ending up in spam — or someone is sending fake emails claiming to be from your domain — an SPF record can fix both problems. This guide explains what SPF is, why it matters, and exactly how to set it up.
What Is an SPF Record?
SPF stands for Sender Policy Framework. It's a DNS record that tells the world which mail servers are allowed to send emails on behalf of your domain. When a recipient's email server receives a message from your domain, it checks your SPF record to verify the sender is legitimate.
Without SPF, anyone can send emails that appear to come from your domain — a technique called email spoofing.
How Does SPF Work?
- You publish an SPF TXT record in your domain's DNS settings.
- When your email is received, the recipient's server looks up your domain's DNS.
- It checks if the sending server's IP address is listed in your SPF record.
- If it matches, the email passes SPF. If not, the server may mark it as spam or reject it.
How to Create Your SPF Record
An SPF record is a TXT record added to your domain's DNS. The format looks like this:
v=spf1 include:_spf.google.com ~all
Here's what each part means:
v=spf1— declares this as an SPF record (always required)include:_spf.google.com— allows Google's servers to send on your behalf (replace with your email provider)~all— "soft fail" — emails from unlisted servers get flagged but not rejected (recommended to start with)-all— "hard fail" — emails from unlisted servers are rejected (stricter, use after testing)
SPF Records for Common Email Providers
| Provider | SPF Record |
|---|---|
| Google Workspace | v=spf1 include:_spf.google.com ~all |
| Microsoft 365 | v=spf1 include:spf.protection.outlook.com ~all |
| cPanel Hosting | v=spf1 a mx ip4:YOUR.SERVER.IP ~all |
| Mailchimp (transactional) | v=spf1 include:servers.mcsv.net ~all |
How to Add Your SPF Record
- Log in to your domain registrar or DNS hosting provider (e.g. Namecheap, GoDaddy, Cloudflare).
- Find the DNS Management section.
- Add a new TXT record with:
- Host/Name:
@(represents your root domain) - Value/Content: your SPF record string
- TTL: 3600 (or the default)
- Host/Name:
- Save the record. DNS changes can take up to 48 hours to propagate (usually much faster).
v=spf1 include:_spf.google.com include:spf.protection.outlook.com ~all
How to Test Your SPF Record
Use a free online tool to verify your SPF record is correct:
- MXToolbox SPF Checker (mxtoolbox.com/spf.aspx)
- Google Admin Toolbox (toolbox.googleapps.com)
Enter your domain name and the tool will show whether your SPF record is valid and correctly configured.