SPF record generator

This SPF record generator builds the TXT record value from the servers and services that send mail for your domain, counts the DNS lookups, and splits a long record.

Generating the record runs in the browser and requires JavaScript. A fixed example is shown.

Generate a record
The domain servers
The a mechanism allows the addresses in the A and AAAA records of the domain, and the mx mechanism allows the servers in its MX records. Each of them needs a DNS lookup.
One address per line, with or without a CIDR prefix, for example 192.0.2.10 or 192.0.2.0/24. The prefix is a number from 0 to 32.
One address per line, with or without a CIDR prefix, for example 2001:db8::1 or 2001:db8::/32. The prefix is a number from 0 to 128.
One domain per line. The servers allowed in the SPF record of each such domain are also allowed to send for the domain, and each include needs at least one DNS lookup.
Common mail providers
Selecting a provider adds its include to the list, and selecting it again removes it.
Servers not in the record (all)
The all mechanism sets the result for messages sent from a server that is not in the record. "-all" asks the receiving server to reject them, "~all" asks it to accept them and mark them as suspicious, and "?all" sets nothing. "+all" is not offered, since it allows any server to send mail for the domain.
Advanced settings
Optional. A domain whose SPF record is checked when no mechanism in the record matched. With a redirect, the all mechanism is left out, since a redirect is never used when all is present.
Optional. A domain whose TXT record holds an explanation returned to the sender when the check fails. Most domains do not need it.
  1. The @ sign means the domain itself, without a subdomain. Some DNS control panels need the full domain name instead, or an empty field.
Characters in the record: 53. Mechanisms that need a DNS lookup: 2 of at most 10.

Everything runs in your browser; nothing is sent or stored.

  • In the "The domain servers" section, select the mechanisms you need (a, mx), and enter IPv4 addresses, IPv6 addresses, and domains to include, one value per line.
  • Selecting a provider name in the "Common mail providers" section adds its include to the record, and selecting it again removes it.
  • In the "Servers not in the record (all)" section, choose the result: reject, mark as suspicious, or no policy.
  • Copy the "TXT record value" and the "Record name (Host)". A record longer than the TXT string limit is also shown split into strings. A domain must have only one SPF record. If a TXT record starting with v=spf1 already exists, update it instead of adding another one, since two records make the check fail (permerror).
  • An SPF record alone does not protect the domain from spoofing: it checks only the sending server and the domain of the return address (Return-Path), not the sender address the recipient sees. Set up DKIM signing and a DMARC record as well. You can create the DMARC record with the DMARC record generator.

What is an SPF record

An SPF (Sender Policy Framework) record is a TXT record on a domain that starts with v=spf1 and lists the servers allowed to send mail for the domain. The receiving server checks whether the IP address of the sending server is authorized in the SPF record of the domain in the return address (Return-Path). The mechanisms in the record are checked in order, and the first mechanism that matches the sending server sets the result. The sign before each mechanism sets the type of result: - to reject, ~ to mark as suspicious, ? for no policy, and +, or a mechanism with no sign, to allow.

The 10 DNS lookup limit

The include, a, mx, ptr, and exists mechanisms, as well as the redirect modifier, each need a DNS lookup during the check. RFC 7208 limits the check to 10 such lookups, including the lookups of the records pulled in with include, and a record that exceeds the limit fails the check (permerror). The ip4 and ip6 mechanisms need no lookup, so IP addresses listed directly in the record do not count toward the limit. When a record gets close to the limit, you can remove the includes of services that are no longer in use.

The difference between -all and ~all

The all mechanism at the end of the record sets the result for a server that is not listed in the record. -all asks the receiving server to reject the message, and ~all asks it to accept the message and mark it as suspicious. When you first set up a record, ~all keeps legitimate messages from being rejected when they come from a service that is not in the record yet, such as an email marketing platform, a CRM system, or a contact form on your website. Once every service that sends mail for the domain is included in the record, you can switch to -all.

Example records

  • v=spf1 mx -allOnly the incoming mail servers of the domain, according to its MX records, are allowed to send, and the result for any other server is a rejection.
  • v=spf1 ip4:192.0.2.0/24 -allEvery address from 192.0.2.0 to 192.0.2.255 is allowed to send, and the record needs no DNS lookups.
  • v=spf1 mx include:example.net ~allThe incoming mail servers of the domain and the servers authorized in the SPF record of example.net are allowed to send, and messages from other servers are marked as suspicious.
  • v=spf1 redirect=example.netThe check uses the SPF record of example.net, so several domains of the same organization can share one record.
  • v=spf1 -allA record for a domain that sends no mail at all: no server is allowed to send mail for the domain.
  • v=spf1 +allAny server is allowed to send mail for the domain, so the record does not protect it. That is why the generator does not offer this value.
Did you know?

With our business email service, an SPF record and DKIM signing are set up automatically for your business domain, and they confirm to the recipients' mail servers that the messages really came from your business.

Business email

SPF record generator FAQ

Can I set up two SPF records for the same domain?

No. A domain must not have two SPF records, because two records that start with v=spf1 make the check fail (permerror). When you add a service that sends mail for the domain, add its include to the existing record, before the all mechanism.

Does an SPF record protect the sender address the recipient sees?

An SPF record does not directly protect the sender address the recipient sees, because it checks the domain in the return address (Return-Path), not the domain in the sender address (From). That is why a spoofed message with your domain in the sender address may pass the SPF check when its return address belongs to another domain. A DMARC record requires the domain checked by SPF or DKIM to align with the domain in the sender address, and sets how to handle a message that does not meet this requirement.

Should I use the SPF record type instead of a TXT record?

No. Set up the SPF record as a TXT record only. The SPF record type was once defined in the standard, but RFC 7208 deprecated it, and receiving servers read only the TXT record.

When should I use redirect instead of include?

With include, only the servers authorized in the record of the included domain are added to the record, and the result for all other servers is set by the all mechanism of the record itself. With redirect, when no mechanism in the record matched, the record of the target domain is checked instead, including its all mechanism. That is why include suits authorizing a mail provider or another service, and redirect suits a domain that follows a shared record of the organization.

Shopping cart

Your cart is emptyYou can start with one of our popular plans.

Site search

Accessibility

Text size
100%
Accessibility statement