Skip to content
Back to blogGuide

DKIM selector lookup: find and check a selector

2 min read
Finding the DKIM selector in a message header and looking up its DNS TXT record

A DKIM selector lookup starts with a message that was actually sent. Open its raw headers and find DKIM-Signature. The s= value is the selector; d= is the signing domain. Query s._domainkey.d as a TXT record.

Find the selector in the message

In Gmail, open the message menu and choose Show original. Search for DKIM-Signature. A header may contain d=example.com; s=selector1;. Use those exact values, including a subdomain in d=. A provider can use different selectors for different sending routes.

Look it up with command-line DNS tools

Replace the example selector and domain with the header values:

dig TXT selector1._domainkey.example.com

Or on systems with nslookup:

nslookup -type=TXT selector1._domainkey.example.com

If DNS returns multiple quoted strings, resolvers may be presenting chunks of one long TXT value. Read them as a single concatenated record. Look for v=DKIM1 and a non-empty p= public key. An empty p= usually indicates a revoked key.

What a real answer looks like

An answer might contain "v=DKIM1; k=rsa; p=MIIB...". The ellipsis here is explanatory: do not copy it as a key. A DNS answer containing a long p= proves that DNS published key material at that selector; it does not prove that a particular message was signed with its matching private key. For that, inspect the received message's DKIM-Signature and Authentication-Results headers. If dig returns a CNAME, query its target and confirm the provider's requested delegation is intact.

Use a browser checker

Enter the signing domain and selector in the DKIM key and DNS record checker. It queries public DNS over HTTPS and reports basic syntax. It does not require a private key, send a test message, or verify the cryptographic signature on a message.

Understand lookup failures

NXDOMAIN or no answer can mean the selector is wrong, the record has not propagated, or the provider uses a CNAME record and the resolver has not followed it. SERVFAIL may indicate a DNSSEC or resolver problem. Check the authoritative DNS host and query again after the record TTL. Do not guess a selector when the received header is available.

Finally, verify the live message. A public key can exist while the sender is not signing, and DKIM can pass while failing DMARC alignment. Read DKIM record examples and DKIM vs SPF vs DMARC.