Skip to the tool
OnPageKit

SPF Record Generator

Compose an SPF TXT record and watch the ten-lookup budget.

Who sends your mail?

Each button adds the include that provider documents. Anything else — a CRM, an invoicing app, your own server — goes in as a term below.

optional
one TXT record at the domain root
v=spf1 include:_spf.google.com -all
DNS lookups
1 / 10
Characters
35
Terms
1
Issues
0

The lookup count is what this record spends on its own. Every include also pays for whatever it nests inside itself, and reading those needs a DNS query — which this page deliberately does not make, because nothing you type here leaves the browser. Check the total with a resolver once the record is live.

paste into your DNS provider

Everything runs in your browser. Nothing you type is sent to a server.

Found a bug in this tool? Report it.

Share this tool

What this tool does

This SPF record generator assembles the single TXT record that lists which servers may send mail using your domain. Pick the providers you use, add your own IP ranges, choose how strict the ending should be, and it produces the exact string to paste into DNS — while counting the DNS lookups it will cost and the characters it occupies.

Composing the record happens entirely in this tab. Resolving it does not: a page in a browser has no way to query DNS, so nothing here is checked against your live zone, and nothing you type is sent anywhere to be checked.

Reading the record you end up with

A record is a version tag, a list of terms and a verdict for everything the terms did not match:

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

include: delegates a decision to another domain's record, which is how a provider can change its sending infrastructure without asking every customer to edit DNS. ip4: and ip6: take a literal address or CIDR range and are the cheapest terms available, because answering them costs no query at all. Bare a and mx mean "the addresses this domain already publishes", which is convenient and quietly expensive. Terms are evaluated left to right and the first match wins, so the final all only applies to a sender nothing else claimed.

The ten-lookup budget is the thing that breaks

Most broken SPF records are not malformed. They are valid, readable, and over budget. Each include: costs one query for itself and then every lookup inside the record it points at — a figure the provider can change without telling you. That is why the counter on this page is honest about measuring only what you wrote: a record showing six lookups here can be resolving to fourteen in production.

Two habits keep you inside the cap. Prefer ip4: for servers whose addresses you control, since literals are free. And delete providers you stopped using — a trial platform from two years ago still costs a lookup and still authorises whoever now owns that infrastructure.

When you genuinely cannot fit, the answer is a flattening service or a subdomain strategy, not a second record. Sending transactional mail from mail.example.com gives that subdomain its own record and its own budget, and it separates the reputation of your receipts from your newsletter.

One name, one record, 255 characters per string

The record lives as a TXT record at the domain root, and there must be exactly one of them starting v=spf1. A single character string inside a TXT record holds 255 bytes; longer records are published as several quoted strings in the same record, which resolvers join back together. Most DNS control panels handle the splitting for you, but a few make you do it by hand, and doing it by inserting a second record is the failure mode to avoid.

What SPF does not do

SPF checks the envelope sender — the address used in the SMTP conversation — against your list. The From line the recipient reads is a different field entirely, and nothing in SPF constrains it. A forger can pass your SPF check by sending from their own authenticated domain while displaying your brand in the From header. Closing that gap needs DKIM, which signs the message itself, and DMARC, which requires one of the two to align with the visible domain and publishes what receivers should do otherwise. Publish all three; SPF is the first of them, not the whole job.

If you are configuring several files at a domain root in one sitting, the ads.txt generator covers the advertising allowlist and the robots.txt generator covers crawler access.

Frequently asked questions

Why is there a limit of ten DNS lookups?

RFC 7208 caps the number of DNS queries one evaluation may cost, so that a hostile record cannot turn every receiving mail server into an amplifier. Terms that need a query are include, a, mx, ptr, exists and redirect; ip4 and ip6 are free because the answer is written in the record. Cross the cap and the result is permerror, which most receivers score the same as a failure.

Should I finish with ~all or -all?

-all says anything not listed is forged, and receivers may reject it outright. ~all says the same thing but asks them to accept and mark it. Publish ~all while you are still finding senders you forgot — the invoicing tool, the recruitment platform, the ticket system — then move to -all once a few weeks of DMARC reports show nothing legitimate failing.

Can I publish two SPF records on one domain?

No. Two TXT records starting v=spf1 on the same name is permerror, and it is the single most common way a working setup breaks: somebody adds a second record for a new provider instead of adding an include to the existing one. One record per domain, with every sender inside it.

Is SPF enough on its own?

No. SPF authorises the envelope sender, which is not the From address a person reads, and it breaks on ordinary forwarding because the forwarding server is not in your list. DKIM signs the message so it survives the hop, and DMARC ties either of them back to the visible From address and tells receivers what to do when neither aligns. SPF alone protects almost nothing about what the recipient actually sees.

Does this tool look up my current record?

It does not, and that is deliberate: everything here runs in your browser, and a browser cannot query DNS. The lookup counter measures what you have written on screen, not what your includes expand to. Use dig, nslookup or any hosted SPF checker once the record is published to see the fully resolved total.

Related tools

Updated