Hosting
Servers
Web Development Pricing
Resources
Get started → Log in
Home/Calculators/SPF record generator
Free tool · runs in your browser

SPF record generator
free, for Google Workspace, Microsoft 365 or your own server.

Tick what sends mail for your domain, add IPs and includes, then copy a ready SPF TXT record. Nothing is sent anywhere; it all runs on this page.

1. Your domain (optional)

Only used in the instructions below the result. It is not added to the record.

2. Servers from your DNS

3. IP addresses

One per line, or separated by commas or spaces. IP entries do not count toward the lookup limit.

4. Include other senders

Add any service that sends mail for you, using the include domain it gives you. The buttons add the standard Google and Microsoft values.

5. What should happen to everything else?

Final policy (all)

Your SPF record

Nothing selected yet. Tick an option, add an IP, or use a quick-add button, and your record appears here.

What SPF is

SPF (Sender Policy Framework) is a DNS record that lists which servers may send email for your domain. When a receiving server such as Gmail gets a message, it looks up the SPF record of the domain in the envelope sender, also called the Return-Path or bounce address, and checks whether the sending server's IP is on the list. If it is, SPF passes. If not, the receiver may mark the message as spam or reject it.

Record syntax and mechanisms

An SPF record is one line of text published as a TXT record. It starts with v=spf1, then lists mechanisms, then ends with an all rule.

example.com.   TXT   "v=spf1 mx include:_spf.google.com ~all"
  • a allows the IP addresses in your domain's A (and AAAA) record.
  • mx allows the servers listed in your MX records.
  • ip4: and ip6: allow one address or a range, such as ip4:203.0.113.5 or ip4:198.51.100.0/24.
  • include: trusts the SPF record of another domain, which is how you allow a mail service such as Google Workspace or Microsoft 365.
  • all goes last and says what to do with every sender not matched above.

Receivers read the mechanisms from left to right and stop at the first match.

~all vs -all

  • -all (fail) says mail from any other server should be rejected.
  • ~all (softfail) says mail from any other server is suspicious, but may still be accepted.
  • ?all (neutral) says nothing either way.

While you are still finding out which services send mail for you, start with ~all. A forgotten sender then lands in spam instead of being rejected. Once you are sure the list is complete and DKIM is working, you can move to -all.

The 10-lookup limit

SPF allows at most 10 DNS lookups while a receiver checks your record (RFC 7208). Each include, a, mx, exists and redirect counts as one. The ip4 and ip6 entries do not count, so they are the cheap way to add a server you control. Includes can contain further includes, and those count too, so the real total can be higher than what you see in your own record. This tool counts only what you add, so treat its number as a minimum. Go over 10 and the check ends with a permanent error, which receivers may treat as a fail.

If you are near the limit, drop services you no longer use, and replace an a or mx with the plain IP address if it will not change.

One SPF record per domain

A domain must have only one SPF record. If you publish two TXT records that both start with v=spf1, SPF returns a permanent error and neither one works. When you add a new service, merge it into the existing record. Put the new include: before the final all, and keep a single all at the end.

How to add it at your DNS host

  1. Open the DNS zone editor wherever your domain's DNS is managed. This is the host named in your domain's nameservers, not always where you bought the domain. If DNS is new to you, read DNS kya hai.
  2. Look for an existing TXT record that starts with v=spf1. If you find one, edit it instead of adding another.
  3. Otherwise add a TXT record. Host or name is @ (some panels want the full domain). Value is the record from the tool above. A TTL of 3600 is fine.
  4. Save, and wait for DNS to update. It is often quick, but can take longer.

Paste the value without extra quotes unless your DNS host asks for them. A long value may be split into several quoted strings of up to 255 characters each. Receivers join them back into one record.

How to test it

Send a message from your domain to a Gmail address you own. Open it, click the three dots, and choose Show original. Near the top you should see SPF: PASS with your sending IP. If it says SOFTFAIL, FAIL or NEUTRAL, the server that sent the mail is not covered by your record. Also check that the lookup count stays within 10 with an SPF lookup tester.

SPF, DKIM and DMARC together

SPF checks the sending server against the envelope sender. DKIM adds a signature to the message that proves it was not changed and that your domain's key signed it. DMARC ties them together: it checks that SPF or DKIM passed for the same domain shown in the visible From address, and tells receivers what to do if not. SPF alone does not stop someone faking your visible From address, because SPF checks the envelope sender, which can be a different domain. DMARC alignment closes that gap. Set up all three; our guide on business email kaise banaye covers them in Hinglish.

Common mistakes

  • Two SPF records. Merge them into one.
  • Going over 10 lookups with too many includes.
  • Forgetting a sender, such as a newsletter tool, a billing system or a website contact form, then switching to -all.
  • Putting all in the middle. Anything after it is ignored.
  • Typing the record as a different type. It must be a TXT record.
  • Using a server name instead of an IP in ip4:. Use a: or include: for names.

SPF on RapidServer

On RapidServer web hosting, business email comes with spam filtering and DKIM/SPF set up for you, so you do not hand-write SPF there. Web hosting is ₹49/mo (3-year plan) plus 18% GST. If you run your own mail server on a VPS (from ₹581/mo plus 18% GST), you publish SPF yourself, along with DKIM, DMARC and reverse DNS. Port 25 opens after a short verification on new accounts, and you can set custom PTR records from the control panel. Read email server on a VPS first to decide if it is worth it. More free tools are on the calculators page, including the robots.txt generator.

Want email without the DNS work?

Business email on your own domain comes with RapidServer web hosting, with DKIM and SPF set up for you.

See web hosting

Frequently asked questions

What is an SPF record?+
It is a TXT record in your DNS that lists the servers allowed to send email for your domain. Receiving servers check it to decide whether a message is genuine.
What is the SPF record for Google Workspace?+
Use include:_spf.google.com. A simple record is v=spf1 include:_spf.google.com ~all. Use the quick-add button above to put it in.
What is the SPF record for Microsoft 365 (Office 365)?+
Use include:spf.protection.outlook.com. A simple record is v=spf1 include:spf.protection.outlook.com ~all.
Can I have two SPF records?+
No. A domain must have only one, or SPF fails with a permanent error. Merge new senders into the existing record.
Should I use ~all or -all?+
Start with ~all while you check that every sender is listed. Move to -all once you are sure, and DKIM and DMARC are in place.
What happens if I go over 10 lookups?+
The SPF check ends with a permanent error, and receivers may treat it as a fail. Remove unused includes, or use IP addresses instead of a or mx.
Does SPF stop people spoofing my email?+
Not by itself. SPF checks the envelope sender, not the From address people see. Add DKIM and a DMARC record so the visible From domain must align with a passing check.
Chat with sales