Back to Blog
🔎
/5 min read/By SMTPfast Team

How to Check the SPF, DKIM and DMARC Records for Your Domain

Look up three DNS TXT records: SPF at the domain itself (v=spf1), DKIM at selector._domainkey.yourdomain.com (v=DKIM1, or a CNAME to your provider), and DMARC at _dmarc.yourdomain.com (v=DMARC1). Use dig on macOS and Linux, nslookup on Windows, or a free online checker, then send a real test email to confirm all three pass.

spfdkimdmarcdnsdeliverabilitytutorial
Share:𝕏in

The short answer: SPF, DKIM and DMARC are DNS TXT records, so you check them with a DNS lookup. Each one lives at a different name:

  • SPF: a TXT record at the domain itself, starting with v=spf1.
  • DKIM: a TXT record at selector._domainkey.yourdomain.com, starting with v=DKIM1, or a CNAME that points at your email provider's key.
  • DMARC: a TXT record at _dmarc.yourdomain.com, starting with v=DMARC1.

Look them up with dig (macOS, Linux), nslookup (Windows) or a free online checker. Then send one real email and confirm that all three pass, because a record that exists can still fail.

The commands

Each record is checked on a different domain, and they are not always the domain in your From address:

  • SPF is checked on the envelope sender (the Return-Path or MAIL FROM domain). Many providers use a bounce subdomain for it, such as bounce.yourdomain.com, so check SPF there as well as on the From domain.
  • DKIM is checked on the d= domain with the s= selector from the DKIM-Signature header.
  • DMARC is always looked up at _dmarc. plus the From domain (or its organizational domain).

In the commands below, replace yourdomain.com with the domain that applies, and selector with your DKIM selector.

Record macOS and Linux Windows
SPF dig +short TXT yourdomain.com nslookup -type=TXT yourdomain.com
DKIM (TXT) dig +short TXT selector._domainkey.yourdomain.com nslookup -type=TXT selector._domainkey.yourdomain.com
DKIM (CNAME) dig +short CNAME selector._domainkey.yourdomain.com nslookup -type=CNAME selector._domainkey.yourdomain.com
DMARC dig +short TXT _dmarc.yourdomain.com nslookup -type=TXT _dmarc.yourdomain.com
MX dig +short MX yourdomain.com nslookup -type=MX yourdomain.com

If you send from a subdomain such as mail.yourdomain.com, the From domain is that subdomain, and its DMARC lookup falls back to _dmarc.yourdomain.com when the subdomain has no record of its own.

How to read the answers

SPF

$ dig +short TXT yourdomain.com
"v=spf1 include:_spf.google.com include:amazonses.com ~all"
  • There must be exactly one record starting with v=spf1. Two records is a permanent error.
  • Every include, a, mx, ptr, exists and redirect costs a DNS lookup, including the ones inside each include. More than 10 is a permanent error. Count them with the SPF checker, which walks every include.
  • The end: ~all (soft fail) or -all (fail) for anything not listed. +all lets anyone send as you.

DKIM

$ dig +short CNAME abc123._domainkey.yourdomain.com
abc123.dkim.amazonses.com.
  • A TXT answer should contain v=DKIM1 and a long p= public key. An empty p= means the key was revoked.
  • Many providers, including Amazon SES and services built on it, use CNAME records that point at a key they host and rotate. Follow the CNAME; the TXT record is at the target.
  • No answer usually means the wrong selector, or a DNS host that added your domain to the name twice (selector._domainkey.yourdomain.com.yourdomain.com).
  • If the CNAME is proxied by your DNS provider (Cloudflare's orange cloud), it does not resolve to the key. DKIM records must be DNS only.

Check a selector with the DKIM checker.

DMARC

$ dig +short TXT _dmarc.yourdomain.com
"v=DMARC1; p=quarantine; rua=mailto:[email protected]; adkim=r; aspf=r"
  • p= is the policy: none (only report), quarantine (spam folder) or reject.
  • rua= is where aggregate reports go. Without it, you never learn who sends as your domain.
  • DMARC passes when SPF or DKIM passes and its domain aligns with the From address. A message can pass SPF for the provider's bounce domain and still fail DMARC.

The DMARC checker explains each tag.

How do I find my DKIM selector?

Open an email you sent, show the original headers, and find DKIM-Signature. The s= tag is the selector and d= is the signing domain:

DKIM-Signature: v=1; a=rsa-sha256; d=yourdomain.com; s=abc123; ...

Paste the headers into the email header analyzer to see the selector and the SPF, DKIM and DMARC results the receiving server recorded. Your provider's domain page also lists the selectors it expects.

Skip the DNS cache

A record you just changed can take a while to show up, because resolvers cache the old answer until its TTL runs out. Ask your domain's own name servers to see what is published right now:

dig +short NS yourdomain.com
dig +short TXT _dmarc.yourdomain.com @ns1.your-dns-host.com

Check the result, not only the records

Records that exist can still fail: a typo in the key, an include that is not there, a From domain that does not align. The real test is a sent email. Send one to the mail tester, which receives it and reports SPF, DKIM and DMARC results with a score and what to fix. Or send to a Gmail address, open "Show original", and look for SPF: PASS, DKIM: PASS and DMARC: PASS.

Set the records up once, with your email provider

Your email provider gives you the exact records. In SMTPfast, adding a domain returns the DKIM, SPF, DMARC and MAIL FROM records, and on Cloudflare-hosted zones one click publishes them through Domain Connect. With Terraform, the SMTPfast provider returns the records so you can publish them in the same apply. For what each record does and why, read DKIM, SPF and DMARC explained.

Sources

Frequently asked questions

How do I check the SPF, DKIM and DMARC records for my domain?

Query the DNS TXT records. SPF: dig +short TXT on the Return-Path (MAIL FROM) domain, and on the From domain, and look for the line that starts with v=spf1. DKIM: dig +short TXT selector._domainkey plus the d= domain from the DKIM-Signature header. DMARC: dig +short TXT _dmarc plus the From domain. On Windows, use nslookup -type=TXT with the same names. Then send a test email and check that the receiving server reports spf=pass, dkim=pass and dmarc=pass.

How do I find my DKIM selector?

Open the headers of an email you sent and find the DKIM-Signature header: the s= tag is the selector and d= is the signing domain. Your email provider's domain settings also list it. Amazon SES and services built on it, such as SMTPfast, publish three DKIM CNAME records with random-looking selectors.

Why does my SPF record fail with too many DNS lookups?

SPF allows at most 10 DNS lookups while it is checked. Each include, a, mx, ptr, exists and redirect counts, and so do the includes inside them. Every service you add (Google Workspace, a CRM, an email API) adds lookups. Remove services you no longer use, or merge them; an SPF checker that walks the includes shows the total.

Can a domain have two SPF records?

No. A domain must have exactly one TXT record starting with v=spf1. Two records make SPF fail with a permanent error. Merge them into one record with several include mechanisms.

Ready to get started?

Start sending transactional email today. Free to start, no credit card required.

Get Started for Free