SPF Record Builder
Compose a Sender Policy Framework TXT record from mechanisms, IPs and includes — with a live DNS-lookup counter and warnings.
v=spf1 mx ~all
- "~all" (softfail) is the safe value to start with. Tighten it to "-all" once your DMARC reports look clean.
Publish as a TXT record on your apex domain. Only one SPF record per domain — multiples are a configuration error.
How to use
- Start from the relaxed preset (
~all) while you discover senders — soft-fail is forgiving for legitimate-but-unlisted mail. - Add every third-party provider via include: — never paste their IPs directly, they rotate.
- Tighten to
-allonce your DMARC reports show no legitimate sources missing.
About this tool
ShowHide
Builds the v=spf1 TXT record that tells receiving mail servers which hosts may send mail for your domain. Add your own sending addresses as ip4 or ip6, pull in third-party senders as include: mechanisms, and choose how the record ends. A running lookup counter sits beside the output, and warnings fire on the usual traps: a record past 255 bytes, a ?all that asserts nothing, and +all, which tells the world that anyone may send as you.
The lookup budget is the constraint that catches people. RFC 7208 allows at most ten DNS lookups per evaluation, and include, a, mx, ptr, exists and redirect each spend one — plus however many their own records spend, recursively. ip4 and ip6 cost nothing, which is why replacing a provider's include with its literal ranges is the standard way out of a record that has outgrown the limit. Go over ten and the result is not a soft failure: evaluation returns permerror, and a receiver treating that as a failure will reject mail that should have been delivered.
Two details decide whether the record does what you think. SPF authenticates the envelope sender — the MAIL FROM address, which appears as Return-Path in the received message — and not the From: header the recipient actually reads. A message can pass SPF cleanly while displaying any sender address at all, which is precisely the gap DMARC's alignment check exists to close. And SPF breaks on plain forwarding: a mailing list or a forwarded mailbox relays your message from its own servers, and unless it rewrites the envelope sender the check fails through no fault of yours. That is the argument for ending in ~all rather than -all while you are still finding out who sends on your behalf.
Publish exactly one v=spf1 record per domain — two of them is a permerror, not a merge — and keep ptr out of it, which the RFC itself says should not be used. TXT strings are capped at 255 bytes each; longer records are split into several strings that receivers concatenate, but a record needing that is usually a record that needs flattening instead.
Frequently asked questions
Why is the 10-lookup limit a big deal?
RFC 7208 caps SPF evaluation at 10 DNS lookups per check (each include:, a, mx, ptr, exists costs one). If you exceed it the verifier returns permerror, which most strict DMARC policies treat as a fail.
Is -all or ~all safer?
-all (hardfail) is the goal once you're sure every sender is listed — DMARC p=reject only kicks in for hard fails. ~all (softfail) is the safer bootstrapping setting; mail still arrives but quarantined.
Can a domain have two SPF records?
No. A domain publishing more than one TXT record starting with v=spf1 is a permanent error, and receivers are entitled to fail the check outright rather than pick one. This is the usual outcome of adding a second provider by pasting their suggested record alongside the existing one — the fix is to merge the mechanisms into a single record with one all at the end.
Does SPF still work when my mail is forwarded?
Often not. A plain forwarder relays the message from its own servers, which are not in your record, so SPF fails at the final destination even though nothing is wrong. This is why SPF alone is a weak basis for rejection and why DKIM matters: a DKIM signature survives forwarding, and DMARC accepts a pass from either.
Related tools
DMARC Record Builder
Compose a _dmarc TXT record — policy, subdomain policy, percentage rollout, alignment, rua/ruf reporting — with safety warnings.
Network
Email Header Analyzer
Paste a raw email header to walk the Received hops in order, see the per-hop delay, and read off the SPF/DKIM/DMARC verdicts.
Network
DKIM Record Builder & Parser
Build or parse a DKIM DNS TXT record — paste your public key, pick selector, key type, hash and flags, and get the record plus its chunked form.
Network
TXT Record Splitter (255-Byte Chunks)
Split a long SPF, DKIM or DMARC TXT record into the 255-byte strings DNS requires, in BIND, generic zone-file, Cloudflare or Route 53 syntax.
Network
Content-Security-Policy Builder
Build a CSP header from per-directive source lists, with three starter presets and live warnings for the dangerous wildcards.
Network
Permissions-Policy Header Builder
Build the Permissions-Policy header: set camera, microphone, geolocation, payment, fullscreen and 20+ other browser features by origin allowlist.
Network