SPF record generator

Tick the services that send email for your domain and get one SPF record to copy. The DNS lookups and the length are checked as you go.
  • Free
  • No sign-up
  • Runs in your browser

Who sends email for your domain?

Tick every service that sends as you@yourdomain. One record covers them all.

Your record so far

v=spf1 include:_spf.google.com ~all

1 of 10 lookups used

What should happen to email from servers you did not tick?

Your SPF record

v=spf1 include:_spf.google.com ~all

Hover over or select any part to see what it does.

  • Uses at least 1 of the 10 lookups SPF allows. Services can add a few of their own.
  • Ends with ~all, the recommended setting
  • 35 characters, fits in one TXT string

Add it to your DNS

At your domain provider, add one TXT record:

Type
TXT
Host
@
Value
v=spf1 include:_spf.google.com ~all

A domain may have only one SPF record. If you already have one, replace it with this one instead of adding a second.

What each part of the record means

An SPF record is one line of text in your DNS. Receivers read it left to right.

  • v=spf1

    Marks the text as an SPF record. It always comes first, and a domain may have only one record that starts with it.

  • include

    Hands the check to another domain's SPF record, usually your email provider's. Each one costs at least one of the ten DNS lookups.

  • ip4, ip6, a, mx

    Name servers directly: by address, or by your domain's own address and mail servers. ip4 and ip6 cost no lookups; a and mx cost one each.

  • all

    The ending: what to do with mail from everyone not listed. ~all marks it, -all rejects it, ?all says nothing.

How to publish it

List every sender first. Your mailbox provider, newsletter tool, help desk, billing system and website can all send as your domain. A sender left out will fail SPF.

Replace, do not add. Look in your DNS for a TXT record on the same host that starts with v=spf1. If there is one, edit it into the record built here. If there is none, add a new TXT record.

Wait, then check. Google says SPF can take up to 48 hours to start working. Then run the domain setup checker to see the live record and its lookup count.

Then add DKIM and DMARC. SPF alone only covers the hidden sender address. Google asks bulk senders for SPF, DKIM and DMARC; the DMARC record generator builds the last one.

Common mistakes

Two SPF records. A second record does not add senders. It breaks SPF for the whole domain (RFC 7208, section 3.2).

Too many includes. Past 10 lookups, SPF fails. Drop services you no longer use, or send some mail from a subdomain with its own record, as Microsoft suggests.

Typing errors. A space after include:, an equals sign in place of the colon, or a dot at the end of the domain all make the term invalid. Microsoft lists these three in its SPF guide.

Ending with +all. It allows every server on the internet to send as you, so the record protects nothing.

Adding a service that does not need it. Some services send with their own bounce domain and pass SPF there. Postmark, for example, says an include is not needed. Follow each provider's own setup page.

Questions

Short answers to the common ones.

Can a domain have two SPF records?

No. RFC 7208 says a domain must not have more than one SPF record, and when a receiver finds two, SPF fails with a permanent error. If you add a new service, put its include into the record you already have.

Should I end my SPF record with ~all or -all?

Both work. Google recommends ~all (soft fail) in its SPF setup guide. Microsoft recommends -all (hard fail) for Microsoft 365 domains that also have DKIM and DMARC. Never use +all: it lets any server send as you.

What is the 10 DNS lookup limit?

Receivers stop after 10 terms that need a DNS lookup: include, a, mx, ptr and exists, plus the redirect modifier. Past that, SPF fails with a permanent error. ip4, ip6 and all do not count. Includes inside includes count too, which is why this page shows the least the record will use.

My SPF record is longer than 255 characters. Is that a problem?

Not if it is split the right way. One TXT string holds at most 255 characters, so a longer record is published as several quoted strings in the same record. Receivers join them with no space added. This generator shows the split for you.

Do I need SPF if I already have DKIM?

Google requires every sender to Gmail to have SPF or DKIM, and senders of 5,000 or more messages a day to Gmail need both, plus DMARC. Having both also means one can still pass when the other breaks, for example when mail is forwarded.

outr checks SPF on every inbox you connect.

It tells you what to fix before anything is sent, then sends your cold email from your own inboxes, follows up, and drafts every reply.