The command for DMARC and DKIM
DMARC is published at _dmarc.example.com, DKIM at selector._domainkey.example.com. Choose the record and your tool, fill in domain and selector, and copy the command.
Only inserted into the commands in your browser.
Only inserted into the commands in your browser.
DMARC · dig · Linux, macOS
DMARC always lives at _dmarc in front of the domain. The answer starts with v=DMARC1; the part that matters is p= (none, quarantine or reject).
dig +short TXT _dmarc.example.com"v=DMARC1;p=reject;sp=reject;adkim=s;aspf=s"DMARC · nslookup · Windows, Linux, macOS
The same record with nslookup, on Windows as well as Linux and macOS. If nslookup reports NXDOMAIN, the domain has no DMARC record.
nslookup -type=TXT _dmarc.example.comNon-authoritative answer:
_dmarc.example.com text = "v=DMARC1;p=reject;sp=reject;adkim=s;aspf=s"DMARC · PowerShell · Windows
Prints only the record text. Without a record Resolve-DnsName raises an error instead of returning an empty answer.
Resolve-DnsName -Name _dmarc.example.com -Type TXT | Select-Object -ExpandProperty StringsDMARC · host · Linux, macOS
The short form for Linux and macOS.
host -t TXT _dmarc.example.com_dmarc.example.com descriptive text "v=DMARC1;p=reject;sp=reject;adkim=s;aspf=s"DKIM · dig · Linux, macOS
DKIM needs the selector. The answer carries the public key after p=; a host name on the line before it means the entry is a CNAME to your mail provider's key.
dig +short TXT selector1._domainkey.example.com"v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA…"DKIM · nslookup · Windows, Linux, macOS
nslookup shows long keys as several quoted chunks. That is correct; one chunk holds at most 255 characters.
nslookup -type=TXT selector1._domainkey.example.comNon-authoritative answer:
selector1._domainkey.example.com text = "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA…"DKIM · PowerShell · Windows
The parentheses print only the Strings property, that is the key. If the entry is a CNAME, Resolve-DnsName follows it on its own.
(Resolve-DnsName -Name selector1._domainkey.example.com -Type TXT).StringsDKIM · host · Linux, macOS
The short form for Linux and macOS.
host -t TXT selector1._domainkey.example.comselector1._domainkey.example.com descriptive text "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA…"The reserved domain example.com publishes both, by the way: DMARC with p=reject and a DKIM record with an empty p=. An empty key means "revoked", so any signature using that selector fails. That is how you lock down a domain that never sends mail.
Finding the DKIM selector
The selector is chosen freely and DNS offers no way to list it. The reliable source is a real message from the domain: in the DKIM-Signature header the selector follows s= and the signing domain follows d=.
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=example.org;
s=selector1; h=from:to:subject:date:message-id; bh=…; b=…With no message at hand, try the provider defaults: Microsoft 365 uses selector1 and selector2, Google Workspace defaults to google, many bulk senders use s1 and s2 or k1. With Microsoft 365 and most sending services the entry is a CNAME; the lookup follows it and prints the target first, then the key.
What the DMARC record says
Tags are separated by semicolons. These are the ones you will meet:
- p= is the policy for the domain: none (monitor only), quarantine (send to spam) or reject.
- sp= applies to subdomains. Without it they inherit p=.
- rua= is the address for daily aggregate reports. Without rua you never learn who sends in your name.
- adkim= and aspf= decide whether domains must match exactly (s) or the organizational domain is enough (r, the default).
- pct= applies the policy to only a share of messages, meant for a gradual rollout.
Errors you can read from the answer
Where the lookup goes wrong and what is behind it:
- Empty answer for _dmarc.sub.example.com: not an error. Subdomains without their own record fall back to the main domain's DMARC record, so query _dmarc.example.com.
- NXDOMAIN for _dmarc.example.com: there is no DMARC record. Receivers treat the domain like p=none without reports.
- Two lines with v=DMARC1: two records are invalid and receivers ignore both.
- The record does not start with v=DMARC1 or has quotes inside the value: a typo, or an editor that stored the quotes.
- Empty answer for DKIM: wrong selector, or the DNS host created "selector1._domainkey.example.com.example.com" because the domain was entered twice.
- DKIM returns a host name but no key: the CNAME points nowhere. With Microsoft 365 that is the case until DKIM is enabled in the Defender portal.
- The key stops mid-value: the DNS host cut the entry at 255 characters. The key has to be split into several strings or published through a CNAME.
Checking without a terminal
The DMARC checker reads the record, validates the syntax and rates how well the policy protects against forged mail. The DKIM checker tries the common selectors on its own and reports key length and revoked keys, so you do not need to know the selector. The glossary explains how DKIM and DMARC work together.