SPF record generator

Tick every service that sends email as you, add any servers of your own, and I'll write one SPF record and count its DNS lookups against the limit of ten.

Who sends email as you?

What goes in an SPF record?

SPF is one TXT record on your domain itself (not on a subdomain like _spf). It starts with v=spf1, lists who may send for you, and ends with what to do about everyone else. Services are added with include:, your own servers with ip4: and ip6:.

Why does the lookup count matter?

Every include, a, mx and exists costs the receiving server a DNS lookup, and includes inside includes count too. RFC 7208 stops at ten. Past that, SPF fails for every email you send, so the count above is worked out the same way, by following each include live.

~all or -all?

With DMARC in place, ~all is the usual choice: DMARC decides what happens to failing mail, and a soft fail still lets a message through if DKIM passes. -all asks receivers to refuse failing mail outright, which can break forwarding.

Some sending services (SendGrid, Amazon SES, Mailgun) send with their own return address unless you set up a custom one, so SPF for them is checked on their domain. What makes DMARC pass for those is DKIM, so set that up in the service too.

Other tools