SPF record generator: how do you build a v=spf1 TXT record?
How does this check work, and what does the result tell you?
AdminKit's SPF record generator assembles the exact v=spf1 TXT record string from the IPv4/IPv6 addresses, include domains, a/mx/ptr mechanisms, redirect and trailing all qualifier you choose — entirely in your browser, with nothing sent to any server. You still need to publish the result in your DNS and confirm it there with AdminKit's live SPF check.
Part of the Email authentication cluster — more tools, guides and terms on email authentication.
Comma-separated, CIDR allowed, e.g. 203.0.113.1, 198.51.100.0/24.
Comma-separated, CIDR allowed.
Comma-separated, one per third-party mail sender's SPF record.
Rarely needed — comma-separated domains for a DNS-existence test.
Authorizes an A/AAAA record. Check the box for this domain's own, and/or list others.
Authorizes a domain's MX hosts. Check the box for this domain's own, and/or list others.
RFC 7208 §5.5 discourages ptr as slow and unreliable — prefer the mechanisms above.
Points evaluation at another domain's record instead of ending in all. Leave blank to use all below.
Ignored if redirect above is set, per RFC 7208 §6.1.
- TXT record for <your domain>
- v=spf1 -all
0 of 10 DNS-lookup-causing mechanisms used (RFC 7208 §4.6.4).
This record is built in your browser only — nothing here is sent to AdminKit or anywhere else. Publish it as a TXT record at the root of <your domain>, then verify it with the live SPF check.
What the result means
This is the record text built from the mechanisms you entered — it says nothing about what your domain currently publishes, and it cannot tell you whether a specific sending server would pass or fail. To see what is actually live in DNS today, run AdminKit's SPF check.
Next step
Publish the record above as a TXT record at the root of your domain, then confirm it with the live SPF check once DNS has propagated.
Keep this result
Copy a link to this check so you can share it or run it again later. Want a heads-up when this result changes? Talk to our team and we'll set it up for you.
How it works and limits
Fill in your mail senders’ IPs, include domains and the other mechanisms below and this tool assembles the exact
v=spf1 TXT record string as you type, entirely in your browser — nothing you enter is sent to AdminKit or
anywhere else. Once you are happy with the result, publish it as a TXT record at the root of your own domain, then
confirm it took effect with AdminKit’s live SPF check, which queries DNS for real and reports
back what it actually found.
What does an SPF record actually authorize?
An SPF record, published as defined in RFC 7208, lists the mail servers allowed to send on behalf of a domain, so a receiving mail server can reject messages forged to look like they came from it. Microsoft Learn’s SPF setup guide walks through the same idea in the context of a specific mail platform — the mechanisms below are what any SPF record is built from, regardless of provider. Google’s SPF setup guide for Workspace adds a point that applies to any record built here: each domain needs its own SPF record, and a subdomain that sends mail needs an SPF record of its own too.
The mechanisms this tool builds
ip4/ip6— authorize specific sending IP addresses or CIDR ranges directly. These cost no DNS lookup to evaluate.a/mx— authorize a domain’s own A/AAAA records or MX hosts, either this domain’s or another’s.ptr— authorizes a domain based on reverse DNS. RFC 7208 §5.5 discourages it (see the FAQ below); this tool still builds it if asked, with a warning.include— pulls in another domain’s SPF record wholesale, the usual way third-party mail-sending services (marketing platforms, helpdesks, CRMs) are authorized.exists— a rarely-needed mechanism that matches if a DNS A-record lookup for the given domain returns any result at all.redirect— points evaluation at another domain’s record entirely, instead of ending the record inall.all— the trailing qualifier (-all/~all/?all/+all) that decides what happens to mail matching nothing else.
How to read the results
- TXT record for <your domain> — the finished record, terms always in the same order:
v=spf1, thenip4,ip6,a,mx,ptr,includeandexiststerms, then either theallqualifier or theredirectmodifier. With every field empty it isv=spf1 -all(no server may send). Copy record puts it on your clipboard. - “N of 10 DNS-lookup-causing mechanisms used” — the count of
a,mx,ptr,include,existsandredirectterms in this record alone. Nested lookups inside an included domain are not counted, because the tool does not query DNS. - Warnings (amber) — appear when
allwas left out because you set a redirect, when the count is over 10, or when the record usesptr. - Errors (red) — replace the record when a value is not valid, for example
"192.0.2.300" is not a valid ip4 address or CIDR.Fix the field and the record comes back.
Examples
| What you enter | Record built | Lookups | What it means |
|---|---|---|---|
ip4 192.0.2.10, all - | v=spf1 ip4:192.0.2.10 -all | 0 | Only that address may send; everything else fails. |
mx box ticked, include spf.example.net, all ~ | v=spf1 mx include:spf.example.net ~all | 2 | Your MX hosts and one provider may send; other mail is soft-failed. |
ip6 2001:db8::/32, redirect example.org | v=spf1 ip6:2001:db8::/32 redirect=example.org | 1 | No all: anything not in the range is judged by example.org’s record. A warning explains why. |
bare ptr ticked, all - | v=spf1 ptr -all | 1 | Built, with the RFC 7208 §5.5 warning against ptr. |
| 11 include domains | v=spf1 include:a.example.com … ~all | 11 | Warning: over the limit of 10, receivers return permerror. |
Limits
- This tool only builds the record text. It never queries DNS and never publishes anything — you still have to add the record to your own DNS and confirm it with a live check.
- It validates the values you enter (address and domain syntax, qualifier keywords) and counts the DNS-lookup-causing
terms it can see, but it cannot see what any
includeorredirectdomain itself resolves to once published — for that fully-resolved count, use AdminKit’s live SPF check.
For a plain-language walkthrough of lookup limits and the all qualifier, see AdminKit’s live
SPF check or the offline SPF validator for checking a record’s syntax
before publishing it. If you are weighing this generator against others, our sourced
comparison of free SPF record generators places it second of four and
says where it is behind. SPF, DKIM and DMARC explained covers how SPF fits
together with the other two records, and once your record is live, AdminKit’s DKIM check and
DMARC check confirm the records SPF works alongside.
Frequently asked questions
Does this tool send anything to AdminKit's servers?
No — every field you fill in is read directly by your browser, and the record string is built there with plain JavaScript. Nothing you type is sent to AdminKit or anywhere else. That also means it cannot check what your domain currently publishes; for that, use AdminKit's live SPF check, which does query DNS.
I built a record here — do I still need to do anything else?
Yes: this tool only builds the text of the record. You still have to publish it yourself as a TXT record at the root of your domain in your DNS provider's control panel, then confirm it actually resolved correctly with AdminKit's SPF check, which queries DNS and follows every include for real.
Why does adding a redirect remove the all qualifier from my record?
RFC 7208 §6.1 states that "Any 'redirect' modifier MUST be ignored if there is an 'all' mechanism anywhere in the record," so a record can't usefully carry both — an all mechanism always matches first and the redirect would never be reached. This tool leaves all out whenever you set redirect, so the redirect you asked for actually takes effect.
Why does the tool warn me about the ptr mechanism?
RFC 7208 §5.5 discourages it directly: "This mechanism is slow, it is not as reliable as other mechanisms in cases of DNS errors, and it places a large burden on the .arpa name servers." The tool still builds it if you ask for it, but flags the warning so you know ip4, ip6, a, mx or include are the more reliable choice.
How many DNS lookups does my record use, and why does that matter?
RFC 7208 §4.6.4 requires that "SPF implementations MUST limit the total number of those terms to 10 during SPF evaluation," counting every include, a, mx, ptr, exists and redirect term. This tool adds up those terms live as you type and warns if you cross 10, since receivers treat an over-limit record as a permanent error (permerror).