Logo

MonoCalc

/

SPF Record Generator

Networking

Quick-fill from common mail provider

Used to preview the full DNS entry

Authorised Senders

Default Policy

What happens to senders not matched by any mechanism above?

Flag but accept unlisted senders

Generated SPF Record

RFC 7208

DNS TXT record value

Publishing instructions: Add a TXT record at yourdomain.com with the value above. Remove any existing v=spf1 records first — a domain must have only one SPF record.

Mechanism Reference

include:domain

Delegate to another domain's SPF

ip4:1.2.3.0/24

Allow IPv4 address or CIDR

ip6:2001:db8::/32

Allow IPv6 address or CIDR

a

Allow domain's A/AAAA records

mx

Allow domain's MX records

ptr

Allow if PTR matches domain (deprecated)

exists:domain

Allow if A record lookup succeeds

redirect=domain

Use another domain's SPF policy

About This Tool

SPF Record Generator – Build Email Authentication DNS Records

SPF (Sender Policy Framework) is a DNS-based email authentication standard defined in RFC 7208 that lets domain owners publish a list of mail servers authorised to send email on their behalf. When a receiving mail server sees a message claiming to be from your domain, it looks up your SPF record to verify that the sending server is on the approved list. If it is not, the server can reject or flag the message as spam — protecting your domain against email spoofing and phishing attacks.

What an SPF Record Looks Like

An SPF record is a DNS TXT record published at your domain apex (e.g.,example.com). It always starts with v=spf1 followed by one or more mechanism tokens and ends with an all qualifier:

v=spf1 include:_spf.google.com ip4:203.0.113.5 ~all

This example authorises Google Workspace and a specific IP address to send mail, and instructs receiving servers to softfail (flag as suspicious) any sender not matched by those mechanisms.

Core SPF Mechanisms

MechanismExampleWhen to Use
include:domaininclude:_spf.google.comDelegate to a third-party provider's SPF policy
ip4:cidrip4:203.0.113.0/24Authorise a specific IPv4 address or CIDR range
ip6:cidrip6:2001:db8::/32Authorise a specific IPv6 address or CIDR range
aa:mail.example.comAllow the A/AAAA records of a hostname to send
mxmxAllow the domain's own MX records to send
redirect=domainredirect=_spf.other.comUse another domain's complete SPF policy
exists:domainexists:%{i}._spf.example.comAllow if an A record lookup on the macro resolves
-all / ~all~allDefault policy for senders not matched by any mechanism

Choosing the Right Default Policy

The qualifier before all is the most important decision in your SPF record. It determines what receiving mail servers do with messages from senders not explicitly listed.

  • -all (Fail) — Receiving servers should reject the message. Use this once you are confident your SPF record is complete and correctly covers all legitimate sending sources.
  • ~all (Softfail) — Accepting servers should accept the message but mark it as suspicious. Softfail is the recommended starting point while testing because it never silently drops legitimate mail.
  • ?all (Neutral) — No policy. The SPF check neither passes nor fails, which gives no benefit for security.
  • +all (Pass all) — Allows any sender, which entirely defeats the purpose of SPF. Never use this.

The DNS Lookup Limit

RFC 7208 imposes a maximum of 10 DNS lookups during SPF evaluation. Each include, a, mx, ptr, andexists mechanism triggers at least one DNS lookup. If your SPF record causes more than 10 lookups, receiving servers return a permerror, which can cause legitimate emails to fail authentication and be rejected.

To stay within the limit, prefer ip4: and ip6: mechanisms where you control the sending IPs, and audit your include: chain to understand how many sub-lookups each third-party SPF record adds.

Using include: for Third-Party Services

Cloud email services publish their own SPF includes. You reference them with theinclude: mechanism. Common examples:

Serviceinclude: value
Google Workspaceinclude:_spf.google.com
Microsoft 365include:spf.protection.outlook.com
SendGridinclude:sendgrid.net
Mailchimp / Mandrillinclude:servers.mcsv.net
Amazon SES (US East)include:amazonses.com
Postmarkinclude:spf.mtasv.net

Publishing Your SPF Record

Once you have generated your SPF record, publish it as a TXT record at your domain apex (the bare domain, not a subdomain). The steps depend on your DNS provider, but in general:

  1. Log in to your DNS provider's control panel.
  2. Navigate to the DNS management page for your domain and look for existing TXT records.
  3. Remove any existing record starting with v=spf1. A domain must have exactly one SPF record; having two causes a permanent error.
  4. Add a new TXT record: Name = @ (or your domain), Value = the generated record string.
  5. Test propagation with: dig TXT yourdomain.com or an online SPF checker.

SPF Alone Is Not Enough

SPF verifies the envelope sender (the Return-Path address used during the SMTP handshake), not the From: header visible to email recipients. For comprehensive email authentication, combine SPF with:

  • DKIM — adds a cryptographic signature to outgoing messages that receivers can verify against a public key in your DNS.
  • DMARC — aligns SPF and DKIM results, provides policy enforcement (none / quarantine / reject), and delivers aggregate reports about authentication failures.

Recommended order of deployment

Start with SPF + DKIM in monitor mode (DMARC p=none), review the aggregate reports for two to four weeks to find any legitimate sending sources you missed, then progressively tighten to p=quarantine and finally p=reject.

Frequently Asked Questions

Is the SPF Record Generator free?

Yes, SPF Record Generator is totally free :)

Can I use the SPF Record Generator offline?

Yes, you can install the webapp as PWA.

Is it safe to use SPF Record Generator?

Yes, any data related to SPF Record Generator only stored in your browser (if storage required). You can simply clear browser cache to clear all the stored data. We do not store any data on server.

What is an SPF record?

An SPF (Sender Policy Framework) record is a DNS TXT record that lists which mail servers are authorised to send email on behalf of your domain. When a receiving mail server checks the SPF record and the sender is not listed, the message can be marked as spam or rejected, which helps prevent email spoofing.

How does this SPF Record Generator work?

Enter the IP addresses, domains, and mechanisms that should be allowed to send mail for your domain. The tool assembles a standards-compliant SPF TXT record string starting with v=spf1 that you can copy and publish in your DNS as a TXT record for your domain. It also validates the record and shows warnings for common misconfigurations.

What is the difference between ~all and -all?

The qualifier before 'all' controls what happens to senders not matched by earlier mechanisms. '-all' (fail) instructs receiving servers to reject those emails. '~all' (softfail) tells receivers to accept the email but flag it as suspicious. '?all' is neutral and has no effect. For strict protection use -all; use ~all while testing to avoid legitimate email being rejected.

How many DNS lookups does an SPF record allow?

RFC 7208 limits the total number of DNS lookups triggered when evaluating an SPF record to 10. Mechanisms that cause lookups include include, a, mx, ptr, and exists. Exceeding 10 lookups results in a 'permerror' which may cause email delivery failures. The tool warns you when your include count approaches this limit.

Should I add ip4 or include for common mail services?

For third-party email services (Google Workspace, Microsoft 365, SendGrid, Mailchimp), use 'include:' with the domain they publish — for example include:_spf.google.com. For on-premises or VPS mail servers where you control the IP, use ip4: or ip6: with the specific address or CIDR range. Using include: is safer because the third-party's IP range may change over time.

Can I have more than one SPF record for a domain?

No. RFC 7208 states that a domain must have at most one SPF record. If two TXT records both start with 'v=spf1', the result is a permanent error and mail may be rejected. If you need to authorise multiple senders, combine all mechanisms into a single record using multiple ip4, ip6, and include entries.