SPF, DKIM and DMARC in plain English
7 min read · Updated 23 October 2026
What are SPF, DKIM and DMARC? They are three DNS records that let a receiving mail server check whether a message really comes from your domain. SPF lists the servers allowed to send your mail. DKIM adds a digital signature to each message. DMARC tells receivers what to do when a message fails those checks, and where to send reports. You can look at all three for your own domain with the SPF, DKIM and DMARC checker.
Anyone can type any "From" address into an email. Without these records, a scammer can send a message that looks like it came from you@yourcompany.com, and your real mail can land in spam because receivers have no way to tell the difference. This guide explains each record, shows how to read one, walks through setup and a safe rollout, and lists the mistakes that cause the most trouble. It is general education, and your email provider's documentation has the exact values for your account.
Why this matters now
Large mailbox providers expect authentication. Google's sender guidelines say that every sender needs SPF or DKIM, and that anyone sending more than 5,000 messages a day to Gmail accounts needs SPF, DKIM and a DMARC record, with the From domain aligned to the SPF or DKIM domain. Those bulk senders also need one-click unsubscribe for marketing messages and must keep their reported spam rate below 0.30%. Even if you send only a few emails a day, valid records help your mail reach the inbox.
SPF: who may send
A Sender Policy Framework record is a TXT record on your domain listing the servers allowed to send its mail:
v=spf1 include:_spf.example.net ip4:203.0.113.10 ~all
Read it from left to right:
v=spf1marks the record as SPF.include:pulls in another domain's list. This is typical for email providers. For example, Google Workspace usesinclude:_spf.google.comand Microsoft 365 usesinclude:spf.protection.outlook.com.ip4:andip6:allow specific addresses or ranges.aandmxallow the addresses your domain's own A and MX records point to.- The ending says what to do with everything else:
-all(fail),~all(soft fail) or?all(neutral). Receivers should not reject on a soft fail alone, but they may look more closely at the message.
An important detail: SPF checks the envelope sender (also called the Return-Path or MAIL FROM), the address used behind the scenes to send the message. It does not check the From address people see. That gap is the reason DMARC exists.
SPF mistakes
- Two SPF records. Only one is allowed per domain. Two cause a permanent error. If you add a new provider, merge it into the existing record.
- More than 10 DNS lookups. Each
include,a,mx,ptr,existsandredirectcosts a lookup, including the ones nested inside included records.ip4,ip6andalldo not count. Past ten, SPF returns a permanent error (permerror) and receivers may treat the check as failed. Too many sending services is the usual cause. - More than two "void" lookups. A lookup that returns nothing counts against a separate limit of two.
- Missing a sender. A forgotten newsletter tool, invoicing system or CRM will fail SPF until you add it.
- Typos. One misplaced character can make the whole record invalid.
DKIM: a signature on each message
DomainKeys Identified Mail adds a cryptographic signature to each message, in a header called DKIM-Signature. The sending server signs with a private key. The receiver looks up the matching public key in DNS and checks that the signature is valid. If a message is changed in transit, the check fails.
The public key is published at <selector>._domainkey.<your domain>, for example s1._domainkey.example.com. The selector (s1 here) is a label your provider chooses, which allows several keys to exist at once. Your email provider gives you the selector and the value to publish, often as a CNAME or a TXT record. Google Workspace commonly uses a selector named google. Microsoft 365 uses selector1 and selector2.
Because selectors vary, a checker can only look up the ones you tell it about, plus a few common defaults. If your tool says "no DKIM found", try the selector from your provider's setup page.
Key size matters. Google's guidelines say DKIM keys must be at least 1024 bits and recommend 2048 bits if your provider supports it. A 2048-bit key is too long for a single DNS text string (255 characters), so it is stored as more than one quoted string in the same record. Most DNS control panels handle this for you.
DMARC: the policy that ties them together
DMARC (Domain-based Message Authentication, Reporting and Conformance) is a TXT record at _dmarc.<your domain>:
v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com; adkim=s; aspf=r
p=is the policy for mail that fails:none(monitor only),quarantine(usually the spam folder) orreject(refuse the message).sp=sets a different policy for subdomains.pct=applies the policy to only a percentage of failing mail. The default is 100.rua=is the address where receivers send daily aggregate reports.adkimandaspfset strict (s) or relaxed (r) alignment. Relaxed is the default and allows subdomains of the same organization.
A message passes DMARC when SPF or DKIM passes, and the domain it passed for aligns with the visible From address.
Alignment, with an example
Say your newsletter tool sends mail with From: hello@example.com, but its envelope sender is bounce@mail.vendor.net.
- SPF passes, but for
vendor.net. That does not align withexample.com, so SPF does not count for DMARC. - If the tool also signs with DKIM using
d=example.com, DKIM passes and aligns. DMARC passes. - If it signs only with
d=vendor.net, DMARC fails, even though both SPF and DKIM passed on their own.
This is the most common reason a legitimate tool fails DMARC. The fix is to complete the "custom domain" or "domain authentication" setup in the tool, which adds DKIM records for your domain.
A safe rollout
- Inventory your senders. List every system that sends as your domain: your mailbox provider, newsletter service, billing system, help desk, website forms, CRM.
- Publish SPF that covers all of them, within 10 lookups.
- Enable DKIM with each sending service, using your own domain.
- Add DMARC with
p=noneand a reporting address. Read the reports for two to four weeks. They show who is sending as your domain and whether it passes. - Fix failures, such as the forgotten tool or the missing DKIM setup.
- Move to
p=quarantine. Many people start withpct=25and raise it in steps to 100. - Move to
p=rejectonce legitimate mail always passes. This is the setting that stops most forged mail.
Report files are XML and are hard to read by hand. Many services will parse them for you.
How to add or edit a record
- Log in to wherever your DNS is managed (your domain registrar, Cloudflare, your web host).
- Open the DNS records page and choose to add a TXT record.
- For the name or host, use
@(or leave it blank) for SPF on the root domain,_dmarcfor DMARC, andselector._domainkeyfor DKIM. Some panels add your domain automatically, so do not type it twice. - Paste the value exactly as shown, without extra quotation marks if the panel adds them.
- Save, wait for the change to spread (often minutes, sometimes longer, depending on the record's TTL), then check it.
Checking the result
Send a test message to a Gmail address and open it. Choose the three-dot menu, then "Show original". Gmail displays SPF, DKIM and DMARC as PASS or FAIL. In Outlook, open the message properties to read the internet headers. In Apple Mail, choose View, Message, All Headers.
The SPF, DKIM and DMARC checker looks up your records from your browser using public DNS-over-HTTPS resolvers, counts SPF lookups and explains each tag. The DNS lookup tool shows the raw TXT records. Valid records help deliverability but do not promise inbox delivery: mailbox providers also weigh sender reputation, content and how recipients react.
Common mistakes
- Jumping straight to
p=rejectwithout reading reports. - Forgetting subdomains and services that send as a subdomain.
- Leaving the default DKIM key for a shared provider domain instead of your own.
- Using SPF alone and assuming it protects the From address.
- Ignoring the reports address, so nobody ever reads the data.
- Forwarding: SPF often breaks when mail is forwarded, while DKIM usually survives. This is why DKIM matters.
FAQ
Do I need all three records? Yes, ideally. DMARC needs at least one of SPF or DKIM to pass and align, but using both is more reliable, especially because SPF can break when messages are forwarded.
What is the difference between SPF and DKIM? SPF checks which server sent the message. DKIM checks that the message was signed by your domain and not altered. They answer different questions, and DMARC combines the results.
What DMARC policy should I use?
Start with p=none to collect reports, then move to quarantine and reject once your legitimate mail passes. For a domain that sends no email at all, p=reject with a matching SPF record of v=spf1 -all is a common setup.
Why does my SPF record say "too many DNS lookups"?
You have more than 10 lookup-causing terms, counting nested includes. Remove services you no longer use, replace includes with ip4 ranges where the provider says it is safe, or send some mail from a subdomain with its own SPF record.
Can I have more than one DKIM record? Yes. Each selector has its own record, so different services can sign mail for your domain independently.
Will DMARC stop all spam? No. It stops other people from forging your exact domain in the From address. It does not stop spam sent from other domains.