Home/Email Security/SPF Record Generator
[ EMAIL — SPF GENERATOR ]

SPF Record Generator

Build a valid Sender Policy Framework (SPF) TXT record for your domain. Pick which mail providers can send for you, add specific IPs if needed, choose how strictly to enforce, and copy the assembled record.

Last reviewed: June 2026

// Everything runs locally in your browser — nothing is sent to our servers.
// 01 — your record14 chars
v=spf1 ~all
0 / 10 DNS lookups
Add at least one sender below — your record will say "no senders authorised" until then.
// 02 — build the record
Used only for the publish instructions below. The SPF record itself doesn't contain the domain name.
Allow the domain's own A/MX to send
Common sending services
These are the current standard SPF includes published by each provider. If your provider isn't listed, use the custom field below.
Custom include domains
No custom includes added.
For any provider not in the presets — check their docs for the correct include: domain.
Specific IP addresses or ranges
No IPs added.
Adds an ip4: or ip6: mechanism. Useful for your own outbound servers. IPs don't count toward the 10-DNS-lookup limit.
Enforcement policy ("all" mechanism)
// 03 — publish
Publish your SPF record as a single TXT record at the apex of your domain (e.g. example.com, not mail.example.com). Only one SPF record is allowed per domain — if you already have one, replace it; don't add a second.
After publishing, wait a few minutes for DNS to propagate, then verify the record with our SPF Checker. It'll flag the 10-DNS-lookup limit, dead include: targets, and other common gotchas.

How does an SPF record actually work?

SPF (Sender Policy Framework) is a published list of who's allowed to send email from your domain. When a receiving mail server gets a message claiming to be from @example.com, it looks up the SPF TXT record for example.com and checks whether the connecting IP is in the list. If it isn't, the receiver applies whatever enforcement the record specifies — soft fail, hard fail, or neutral.

An SPF record always starts with v=spf1 and is a single space-separated string of mechanisms followed by an "all" qualifier at the end. The mechanisms are the things that authorise sending — a, mx, include:, ip4:, ip6: — and the qualifier is what to do with everyone else.

Should I start with -all or ~all?

Start with ~all. Soft fail tells receivers "this sender wasn't authorised, but maybe accept it anyway and treat it as suspicious." That's the right default while you're still discovering which third parties send email on your behalf — you'll see them in DMARC aggregate reports and can add them to the record before any legitimate mail breaks.

Once you've watched the reports for a few weeks and confirmed that every legitimate sender is in your record, tighten to -all. Hard fail tells receivers to reject anything not on the list, which is what you ultimately want.

The 10 DNS lookup gotcha

The SPF spec caps the number of DNS lookups a receiver will do while evaluating your record at 10. Every include:, a, mx, exists:, and redirect= mechanism counts. (Plain ip4: and ip6: don't.) Go over and receivers treat your record as permerror, which most reject.

It's easier to hit than you'd think — including Google Workspace, Microsoft 365, SendGrid, and Mailgun together is already 4 of your 10. If you cross the limit, the standard fix is "flattening" — replacing some include: mechanisms with the IPs they expand to, refreshed periodically. Our SPF checker shows the current lookup count for any domain.

Where does this go?

Publish the assembled record as a TXT record on your DNS provider, at the apex of the domain (just example.com). The record value is the literal string the generator outputs — most DNS providers will wrap it in quotes for you automatically. After publishing, give DNS a few minutes to settle, then verify with the SPF Checker.

Last reviewed by Network Lookup Team, June 2026.