Skip to content

SPF lookup

Enter a domain to see its SPF record, explained one rule at a time.

Example: SPF check of github.com

What is an SPF record?

SPF (Sender Policy Framework) is a TXT record that lists the servers allowed to send e-mail for a domain. A receiving server looks it up for the domain in the envelope sender (the Return-Path) and checks whether the connecting IP address is on the list.

The record is read left to right. The first rule that matches the sending server decides the result; the all rule at the end covers everyone else.

How to read an SPF record

In a zone file, the record looks like this:

example.com.   300   IN   TXT   "v=spf1 ip4:192.0.2.0/24 include:_spf.example.net ~all"
  • v=spf1 marks the record as SPF. It must come first.
  • ip4 and ip6 allow an address or a range.
  • include allows every server that passes another domain's SPF record. Mail providers give you one to add.
  • a and mx allow the domain's own addresses and its mail servers.
  • all matches everyone else. -all tells receivers to fail them, ~all to treat them as suspicious.

From the command line

Look up SPF records without this site.

On macOS and Linux, use dig:

dig example.com TXT +short

On Windows, use nslookup:

nslookup -type=TXT example.com

To skip caches, ask one of the domain’s nameservers directly: dig @ns1.example.net example.com TXT.

Questions and answers

Can a domain have more than one SPF record?

No. Two TXT records that start with v=spf1 make SPF fail for every message. Merge them into one record.

What is the 10 lookup limit?

A receiver makes at most 10 DNS lookups while it checks a record. Every include, a, mx, exists and redirect costs one, and so do the ones inside included records. Past 10, the check fails with a permanent error. Remove the includes of services you no longer use.

Should the record end in -all or ~all?

With DMARC in place both work, because DMARC only asks whether SPF passed. ~all is the safer choice while you are still finding every service that sends for you.

My domain sends no e-mail. Do I need SPF?

Yes. Publish v=spf1 -all so that nobody else can send as the domain.

Other record types