b2KIT

SPF Record Generator

Build SPF DNS records with an interactive tool to authorize email senders and prevent spoofing.

Tested tool guide Tested browser tools Checked August 16, 2026

What SPF Record Generator does, with a checked example

This tool assembles an SPF TXT record from the pieces of your mail setup: your domain, the IPs of your own mail servers, and include: entries for third-party senders like Google Workspace or your marketing service. It orders the mechanisms, appends the required terminating 'all' mechanism, and returns a publish-ready DNS value. The thing users get wrong most often: SPF authenticates the envelope sender, not the address shown in the From line, so a correct record alone does not stop the spoofing users actually see.

Worked example

A concrete input and expected output from the current implementation.

Input

domain: example.com, mail server IP: 203.0.113.10, provider: Google Workspace

Expected output

v=spf1 include:_spf.google.com ip4:203.0.113.10 -all

Each entered sender becomes a mechanism in the record: the Google Workspace include, the single documentation-range IP, and -all to reject everything not listed. The ip4 mechanism costs no DNS lookups; the include costs one of the ten-lookup budget.

How the result is produced

1

Mechanisms in evaluation order

An SPF record is a single TXT value that starts with v=spf1 and then lists mechanisms. Receivers walk them left to right and act on the first match. The generator renders your mail servers as ip4: or a: mechanisms, third-party services as include: entries, and appends one all mechanism with the disposition you choose, since without it, unmatched senders get a neutral result instead of a rejection.

2

The ten-lookup limit

Evaluation may perform at most 10 DNS lookups; each include, a, mx, and redirect counts as one, and included records can chain their own includes on top of that. Over the cap, the check returns permerror, which receivers treat as neutral. TXT strings are also capped at 255 octets, so long records get split into multiple character-strings - a split some DNS software mishandles.

Good uses

  • Publishing the first record for a new domain so outgoing mail from your servers and services stops landing in receivers' spam folders.
  • Adding a newly hired marketing or transactional platform by appending its documented include: entry to the existing record.
  • Tightening a placeholder ~all record to -all after inventorying every legitimate sender, so nothing unlisted is accepted as coming from your domain.

Limits and checks

  • SPF verifies the envelope sender, not the From header users see. A record that passes perfectly does not stop spoofing of the visible From address; closing that gap requires DMARC and ideally DKIM alongside it.
  • -all rejects mail from anything you did not list, so an incomplete sender inventory bounces real mail; ~all delivers but marks it. Publish ~all first, audit, then tighten.
  • DNS caches the old record until its TTL expires, so after publishing you can keep seeing the previous behavior for hours. Verify with a record lookup after propagation rather than concluding the change failed.

Common questions

Mail from my subdomain goes out with mail.example.com as the envelope domain. Does example.com's SPF record cover it?

No. SPF looks up the TXT record at the exact domain in the envelope sender address, and subdomains do not inherit their parent's record. If envelope mail is sent from mail.example.com, publish the record there as well, or configure sending with the bare domain so one record covers everything.

How many include: entries can one record hold?

There is no fixed count, but evaluation may make at most 10 DNS lookups, counting each include, a, mx, and redirect as one query - and included records can chain further includes of their own. Going over the cap yields permerror, treated as neutral, so your record silently stops working. Consolidate providers or use redirect= to stay inside the budget.

References and verification

The example and behavioral notes were checked against the browser implementation. Standards and primary references below define the relevant format, formula, or platform behavior.

Related Tools