Is there a method to find a domain's DKIM and DMARC records using dig or nslookup?

I have attempted to do the following:

dig somedomain.org any

returns many records, but not the known DKIM and DMARC text records.

nslookup -type=txt somedomain.org

returns all the text records known except the DKIM and DMARC records.

  • 2
    DKIM records are applied to arbitrary subdomains (Google Apps uses google._domainkey.example.com) that you'd have to know/guess to look for.
    – ceejayoz
    Commented Aug 29, 2014 at 15:38
  • 1
    It depends on the selector prefix used, part of the DKIM header in a signed email Commented Aug 29, 2014 at 15:57

5 Answers 5


To query the TXT record for DMARC, you can use:

dig TXT _dmarc.example.org

To query for a particular record for DKIM, you would need to know the selector prefix. You will find it in the s value in an email's DKIM-Signature.

For example:

DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=example.org;
s=google; t=1615461277;

You would then query it as TXT:

dig TXT google._domainkey.example.org

For DKIM records, if you have received a DKIM-signed email from that domain, look at the DKIM-Signature header line(s).

From the spec:

All DKIM keys are stored in a subdomain named _domainkey. Given a DKIM-Signature field with a "d=" tag of example.com and an "s=" tag of foo.bar, the DNS query will be for foo.bar._domainkey.example.com.

So in this example, you can then run:

dig TXT foo.bar._domainkey.example.com

Credit to andol, whose comment led me to this solution.


You should use +short with dig to get the DMARC record only.

dig +short TXT _dmarc.domain.com

Using Windows built-in tool nslookup

  1. Open Command Prompt (cmd.exe)
  2. Enter nslookup
  3. Enter set type=txt
  4. Enter _dmarc.somedomain.org, replace somedomain.org



Default Server:  localdns

> set type=txt

> _dmarc.somedomain.org

Non-authoritative answer:
_dmarc.somedomain.org text =

    "v=DMARC1; p=none; rua=mailto:[email protected]"

You may use server (Google DNS) before lookup DMARC TXT record.

  • 1
    Wouldn't nslookup -type=txt _dmarc.somedomain.org [] be simpler?
    – mwfearnley
    Commented Nov 5, 2019 at 10:42

You can directly query the API at the registry.prove.email DKIM registry via POSTing any domain, and then get any known selectors and current/historical DKIM keys back for about 7,000+ DKIM keys! So you wouldn't use dig or nslookup, you'd cURL the API instead. You wouldn't need to know the selector.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .