SPF record generator
Tick the services you send mail with and we'll write a correct SPF record.
Results for example.com
Ready to publish
Here’s your SPF record
Add this as a TXT record on example.com. A domain can have only one SPF record — if you already have one, replace it.
Host: example.com · 35 bytes
Soft fail: mark it, don’t reject
What it allows2
| Term | Value |
|---|---|
include | _spf.google.com |
~all | – |
Services1
| Service | Include |
|---|---|
| Google Workspace / Gmail | include:_spf.google.com |
Publishing notes
- Lookup counts behind the included services are a snapshot of what they published when this tool was written; confirm the live count with the SPF checker after publishing.
- Publish this as a single TXT record at example.com (host "@"). A domain must have exactly one SPF record: if one exists already, merge them instead of adding a second.
- Most DNS panels add the surrounding quotes for you: paste the record without them. Zone files and some APIs need the quotes.
- ~all (softfail) is the safe starting point. Once DMARC is enforcing and all your senders are listed, -all is reasonable.
Structured result (JSON) · 1.2 KB
{
"domain": "example.com",
"host": "example.com",
"record": "v=spf1 include:_spf.google.com ~all",
"length": 35,
"chunks": [
"v=spf1 include:_spf.google.com ~all"
],
"zoneLine": "example.com. 3600 IN TXT \"v=spf1 include:_spf.google.com ~all\"",
"terms": [
"include:_spf.google.com",
"~all"
],
"lookups": {
"direct": 1,
"knownNested": 0,
"total": 1,
"limit": 10,
"estimated": false
},
"providers": [
{
"id": "google-workspace",
"name": "Google Workspace / Gmail",
"include": "_spf.google.com"
}
],
"valid": true,
"issues": [],
"notes": [
"Lookup counts behind the included services are a snapshot of what they published when this tool was written; confirm the live count with the SPF checker after publishing.",
"Publish this as a single TXT record at example.com (host \"@\"). A domain must have exactly one SPF record: if one exists already, merge them instead of adding a second.",
"Most DNS panels add the surrounding quotes for you: paste the record without them. Zone files and some APIs need the quotes.",
"~all (softfail) is the safe starting point. Once DMARC is enforcing and all your senders are listed, -all is reasonable."
]
}What the generator does
Choose the services that send mail as your domain, add your own servers if you have any and pick how the record should end. The generator writes the SPF record, gives you a zone-file line (the plain-text format DNS servers store records in), shows how many of the 10 allowed DNS lookups the record uses and warns you about anything that would cause trouble. Because the record is built from your choices, its syntax is always right.
An SPF record is one line of text in your DNS, but a small mistake in it can quietly break delivery. The limit of 10 DNS lookups is one of the most common ways a record fails, which is why the generator counts them.
The generator makes no DNS requests, so it does not know what your DNS already holds. If you already have an SPF record, merge the new terms into it. Your choices go to our server, which builds the record. They are not part of our routine logs and are held in memory for at most a day. On the website, Google Analytics also records what you enter, as the privacy policy explains.
How to build your record
- Choose your mail servicesPick every service that sends mail as your domain. The list has 18, among them Google Workspace, Microsoft 365, SendGrid, Mailchimp, Amazon SES, Mailgun, Postmark, Zoho Mail and Fastmail. Each one adds the include its provider documents. For a service that is not listed, type its include domain under Other includes.
- Add your own serversEnter IPv4 or IPv6 addresses or networks for mail you host yourself. Turn on "Allow my MX servers" or "Allow my domain's A record" only if those hosts really send mail.
- Pick the endingThe "Everything else" menu says what happens to mail from every other server.
~all(softfail, the default) marks it as suspicious,-all(fail) asks receivers to reject it and?all(neutral) makes no statement. The questions below explain which to use. If another domain already holds your full policy, the advanced option "Redirect to another domain" hands the decision to it and the record needs no ending. - Publish itCreate one TXT record on your domain, with the host shown as
@in most panels, and paste in the generated value. Delete or merge any older SPF record. Then check the result with the SPF checker once DNS has updated.
Understanding the output
For a domain that sends through Google Workspace and SendGrid, with a softfail ending, the generator produces:
v=spf1 include:_spf.google.com include:sendgrid.net ~all- The record and its length. Terms always come in the same order:
mx,a,ip4,ip6, your includes, then the ending. A record longer than 255 bytes is also shown as several quoted strings inside one TXT record, together with a zone-file line. - The lookup count. Each
include,a,mxandredirectcosts one lookup, plus whatever the included record uses itself. The generator has those inner counts for only a few services, from a snapshot taken when it was built, and providers change their records. When any are unknown, or you add an include of your own, the count is shown as a minimum. Publish the record and run the SPF checker for the exact number. - Warnings and errors. Warnings cover
?all, private or loopback addresses that receivers will never see, a record with 8 or more lookup terms and a record longer than 450 bytes. Errors cover invalid addresses and prefixes and a record that needs more than 10 lookups. A record with an error is not shown, so you cannot copy it by mistake. Duplicate terms are removed for you. - The host name. The record belongs on the domain itself, shown as
@in most DNS panels.
Mistakes to avoid when publishing
- Adding a second SPF record. Edit the existing one. Two records are invalid, and receivers ignore both.
- Forgetting a sender. Invoicing tools, CRMs, ticket systems and web forms often send as your domain. Look at the headers of your sent mail before you move to
-all. - Using too many services. Past 10 lookups the generator refuses to show a record. Move bulk senders to a subdomain such as
news.example.comwith its own SPF record, or remove services you no longer use. - Using
aormxout of habit. They add lookups and may allow servers that never send mail. - Listing a private address. An address such as
10.0.0.5never appears as the sender of mail from the internet. List the public address of your mail server instead. - Letting the DNS host change the value. Some panels need the value in quotes and others add them. Some want a long value split into 255-byte parts. Check what was published with a TXT lookup.
- Expecting subdomains to inherit. SPF does not pass from a parent domain to its subdomains. Each domain that appears in the return path needs its own record. A subdomain that never sends mail can publish
v=spf1 -all.
How it works
The generator cleans your input (lowercase domains, standard IP notation, no stray spaces), checks each term against RFC 7208 and writes the record. It adds the lookup terms in your record to the inner counts it knows for each listed service. If a service's inner count is unknown, the total is marked as a minimum. The same function runs behind the REST API and the MCP server.
Standards
- RFC 7208: SPF syntax, qualifiers, the limit of 10 lookups and the rule that a domain publishes one record. It also dropped the separate SPF record type, so SPF lives in TXT records.
- RFC 1035: TXT records and the 255-byte limit of one character string. RFC 7208 joins the strings of a TXT record with nothing between them.
- RFC 5321: the SMTP envelope sender that SPF checks.
Questions people ask
How do I create an SPF record?
Pick your sending services and servers, choose an ending (~all or -all) and copy the generated line. Publish it as a TXT record on your domain, then check it with the SPF checker. If you already have an SPF record, add the new include: and ip4: terms to it instead of creating a second record.
Where do I put the SPF record?
Put it in your domain's DNS zone as a TXT record on the domain itself, often shown as @. It is not a separate record type. RFC 7208 dropped the old dedicated SPF type, so receivers read only the TXT record. Add it wherever your DNS is managed, which is usually your registrar or hosting provider.
Can I combine Google Workspace and another service?
Yes. Select both. They become separate include terms in one record, and the generator shows how many lookups the pair uses. Add as many services as you need, as long as the total stays at 10 or below. If it does not, send bulk mail from a subdomain.
What does include:_spf.google.com do?
It tells receivers to also accept the servers listed in Google's own SPF record. Google maintains that record, so you do not have to track its addresses. The include costs one DNS lookup, plus any lookups inside Google's record. Prefer the include your provider documents over a copy of its IP addresses, which goes stale.
Should I use ~all or -all?
Start with ~all while you confirm that every sender is included, then move to -all if you want strict failure. Once DMARC is enforcing, ~all is common and enough, because receivers then follow your DMARC policy. The generator offers ~all, -all and ?all, and uses ~all unless you choose otherwise.
How do I make an SPF record for a domain that sends no email?
Leave every service and address empty and choose -all. The generator gives you v=spf1 -all, which tells receivers that no server may send mail as the domain. Publish it on parked domains and on subdomains that never send mail, together with a DMARC record of p=reject.
Does the generator check whether my providers are really configured?
No, it only builds the record. It never looks at your DNS or your mail setup. After publishing, use the SPF checker to validate the record against live DNS, and send a test message from each service to confirm it passes.
Use it from AI, the API or the command line
Every LookupOwl tool is also a free API and an MCP tool, with no key and no account. This one is spf_generate. Please be kind to the rate limits.
curl "https://lookupowl.com/api/v1/tools/spf-generator?q=example.com&providers=google-workspace"claude mcp add --transport http lookupowl https://lookupowl.com/mcp