ReplyDak

How to check SPF, DKIM and DMARC with dig and nslookup

Updated 10 November 2026 · 5 min read

Short answer

Check SPF with dig +short TXT yourdomain.com (look for one line starting v=spf1), DKIM with dig +short TXT selector._domainkey.yourdomain.com (you must know the selector), DMARC with dig +short TXT _dmarc.yourdomain.com, and MX with dig +short MX yourdomain.com. On Windows use nslookup -type=txt with the same names. Add @8.8.8.8 to ask a public resolver, or the domain's own nameserver to skip caches.

Commands

CheckmacOS / Linux (dig)Windows (nslookup)
SPFdig +short TXT acme.comnslookup -type=txt acme.com
DKIMdig +short TXT google._domainkey.acme.comnslookup -type=txt google._domainkey.acme.com
DKIM (CNAME style)dig +short CNAME selector1._domainkey.acme.comnslookup -type=cname selector1._domainkey.acme.com
DMARCdig +short TXT _dmarc.acme.comnslookup -type=txt _dmarc.acme.com
MXdig +short MX acme.comnslookup -type=mx acme.com
PTR for a sending IPdig +short -x 203.0.113.10nslookup 203.0.113.10

Reading the answers

  • SPF: exactly one string starting v=spf1. Other TXT lines (verification codes) are normal. Two v=spf1 lines is an error.
  • DKIM: a string with v=DKIM1 (optional) and p= followed by a long base64 key. p= with nothing after it means the key was revoked. Long keys appear as two quoted strings, which is fine.
  • DMARC: one string starting v=DMARC1; followed by p=. Nothing returned means no DMARC.
  • MX: priority and host, e.g. 1 smtp.google.com.
  • PTR: a host name whose own A record maps back to the same IP (forward-confirmed reverse DNS).

Worked example

$ dig +short TXT getacme.com
"google-site-verification=3x..."
"v=spf1 include:_spf.google.com ~all"
$ dig +short TXT _dmarc.getacme.com
"v=DMARC1; p=none; rua=mailto:dmarc@getacme.com"
$ dig +short TXT google._domainkey.getacme.com
"v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA..." "...IDAQAB"

One SPF record, a DMARC policy and a DKIM key split into two strings: this domain is set up correctly.

Finding the DKIM selector

DNS has no way to list selectors, so you need the name. Open a message the domain sent, view the original, and read s= in the DKIM-Signature header. Details: how to find your DKIM selector.

Skip caches

dig +short NS acme.com
dig +short TXT _dmarc.acme.com @<one of those nameservers>

Check the result

Prefer a browser? The free check runs the same lookups and explains each result. Run the domain through the free ReplyDak deliverability check: it reads MX, SPF, DKIM and DMARC live from public DNS, counts SPF lookups and checks the main blocklists, with no sign-up. If your DKIM selector is not a common one, type it into the optional selector box.

More setups and errors: SPF, DKIM and DMARC by provider, DNS host and error.

FAQ

How do I check a DKIM record?

Query TXT at selector._domainkey.yourdomain.com. You need the selector, from the s= tag of a sent message's DKIM-Signature header.

What is the nslookup command for DMARC?

nslookup -type=txt _dmarc.yourdomain.com.

Why does dig return nothing for my DMARC?

There's no record at _dmarc, it was added at the wrong DNS host, or the name was doubled when entered.

Sources

Related

Microsoft 365 mailboxes are coming soon. Until then, new orders use Google Workspace mailboxes.