Skip to Main Content
Back to Learning CenterEmail Authentication

DKIM record format

By Dominic LandryAugust 13, 20267 min read

In brief

DKIM record format uses a DNS TXT record at selector._domainkey.domain with a required public key in p=. Learn the valid tag structure and core rules.

DKIM record format

A DKIM record format is a DNS TXT record published at ._domainkey.. Its value is a semicolon-separated tag list that contains a required p= tag with the public key. v=DKIM1 is recommended and must be first when present. The selector and domain come from the sending message's DKIM-Signature header, so the exact hostname and key value must come from the sending platform.

At a glance

Quick takeaways

  • A DKIM public key record uses DNS TXT, according to RFC 6376.
  • The lookup name is ._domainkey..
  • Only p= is required in the DKIM key record.
  • If present, v=DKIM1 must be the first tag.
  • TXT chunks must join with no inserted whitespace, and a selector must have one unique TXT record.
  • A CNAME can delegate a selector to a vendor hostname, but DKIM ultimately reads a TXT record.

How the DKIM record format works

DKIM lets a receiving system retrieve a public key that corresponds to a signature on an email message. The signer places its domain in the signature's d= tag and its selector in s=. For d=example.com and s=selector1, the receiver queries:

Technical exampletext
selector1._domainkey.example.com

The _domainkey label is fixed by the DKIM DNS namespace. The selector is chosen by the signer, which lets one domain publish separate keys for different sending services or key changes.

RFC 6376 defines DNS TXT as the required base binding for DKIM keys. A record is a tag list, with tags separated by semicolons. The central tag is p=, which carries the base64-encoded public-key data. Do not copy a public key from an example into production. Your email platform generates the matching private key and public key pair.

The primary tags are:

  • v=DKIM1: Identifies the record version. It is recommended. If included, it must be first and must be exactly DKIM1.
  • p=: Contains the public key. It is required. An empty p= explicitly revokes that selector's key.
  • k=: Names the key type. RFC 6376 defaults to rsa; RFC 8463 adds ed25519.
  • h=: Optionally limits acceptable hash algorithms.
  • s=: Optionally limits the service types for which the key applies. Its default is *.
  • t=: Optionally sets flags, including y for DKIM testing and s to limit the relationship between i= and d= domains.
  • n=: Optional human-readable notes.
Record anatomy showing the DKIM selector hostname and the required public-key tag
Source: Palisade.

For the wider role of this record alongside SPF and DMARC, see the DKIM learning hub.

When a DKIM record is valid, delegated, or unusable

A minimum valid DKIM key record can contain only p=. In practice, records commonly begin with v=DKIM1; followed by k= and p=. A record that starts with another version value must be discarded by a verifier.

Treat these as separate checks:

  • The selector name must match the s= value in the message signature.
  • The domain after _domainkey must match the signature's d= value.
  • The p= value must be the public key generated for that selector.
  • The selector must return one usable TXT record. RFC 6376 says results are undefined when multiple TXT records exist for a selector.
  • Long TXT values may be split into quoted DNS strings, but resolvers must concatenate them with no intervening whitespace. A space inserted into the public key changes its value.
Do not replace an existing selector record with a new value until you know which sender uses it. Removing or changing the public key before the sender changes its matching private key can make legitimate DKIM signatures fail.

A CNAME changes the lookup path, not the DKIM format. RFC 1034's CNAME rules allow a DNS name to be an alias for another canonical name. A sending vendor may ask you to publish a CNAME at selector1._domainkey.example.com that points to its hostname. The resolver follows that alias and retrieves the TXT record at the target. A CNAME node cannot also hold a TXT record.

This distinction matters when reviewing vendor instructions. The record at your selector can be a CNAME delegation, while the DKIM key record that the verifier reads remains a TXT record. For that vendor-managed pattern, see what a DKIM CNAME record is.

For RSA keys, RFC 6376 requires signers to use at least 1024-bit keys for long-lived keys. Google's Gmail sender guidance requires at least 1024 bits for personal Gmail and recommends 2048 bits where the DNS provider supports it. RFC 6376 also notes that large keys can encounter DNS response-size constraints.

Worked DKIM TXT record example

RFC 6376 Appendix C provides this illustrative public-key record. The $ORIGIN line means the full owner name is brisbane._domainkey.example.org.

Technical exampletext
$ORIGIN _domainkey.example.org.
brisbane IN TXT ("v=DKIM1; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQ"
                 "KBgQDwIRP/UC3SBsEmGqZ9ZJW3/DkMoGeLnQg1fWn7/zYt"
                 "IxN2SnFCjxOCKG9v3b4jYfcTNh5ijSsq631uBItLa7od+v"
                 "/RtdC2UzJ1lWT947qR+Rcac2gbto/NMqJ0fzfVjH4OuKhi"
                 "tdY9tf6mcwGjaNBcWToIMmPSPDdQPNUYckcQ2QIDAQAB")

The quoted strings form one logical TXT value. They do not add spaces between lines. In the RFC's matching signature example, s=brisbane identifies the selector and d=example.com identifies the signing domain.

That example shows the format, not a reusable key. A real record needs the selector and p= value generated by the exact sender that will sign messages. If you need a visual example rather than a grammar explanation, read what a DKIM record looks like.

Check the record against the message evidence

Start with the evidence you have:

  • If you have a delivered message, inspect its DKIM-Signature header for d= and s=. Those values produce the exact DNS name to query.
  • If you have only a domain and selector, use dig or another DNS lookup to retrieve the TXT or CNAME response. This DKIM dig guide covers the command and how to interpret the result.
  • If DNS looks correct, check the sending platform's DKIM verification status and send a new message through the same production path.
  • Then inspect the delivered message's authentication results. A published public key does not prove that the application used the matching private key or that the signature passed.
DNS publication is only the first validation layer. The sender's status and a real message header confirm different parts of the configuration.

Look up the selector record you found

When you have the domain and selector from a DKIM-Signature header, query that exact hostname and compare the DNS answer with the sending platform's generated record.

Inspect a DKIM record with dig

A DNS lookup cannot prove that the application signed a specific message, that the public key matches its private key, or that a receiving mailbox provider accepted the message.

Evidence

Sources and further reading

Questions readers ask

Frequently asked questions

What is a valid DKIM record example?

A valid example is the RFC 6376 Appendix C record beginning v=DKIM1; p=... at a selector hostname such as brisbane._domainkey.example.org. The record's public key is illustrative only. Your sending platform must generate your own selector and p= value.

How do you write a DKIM record?

Publish a TXT record at ._domainkey. with a tag list containing p=. Include v=DKIM1 first when you use it. Keep split TXT strings as one logical value with no inserted whitespace, and do not publish multiple TXT records for one selector.

What does a DKIM TXT record look like?

A DKIM TXT record usually starts with v=DKIM1 and contains a long p= public key value. See what a DKIM record looks like for a focused example, then use this page to check the tag rules and DNS name.

Is a DKIM record a TXT or CNAME?

A DKIM key record is a TXT record. A sender may instead instruct you to publish a CNAME at the selector hostname, which DNS resolves to a vendor-hosted TXT record. The CNAME is a delegation mechanism, while the DKIM key itself remains TXT data.

Can a DKIM record have an empty p= tag?

Yes. RFC 6376 defines an empty p= value as a revoked public key. It tells verifiers that the selector is known but signatures that rely on that key should fail verification.

Manage DKIM records through Palisade

Start in Palisade.

Get started

Share this article

Dominic Landry

Written by

Dominic Landry

Deliverability & DNS

Dominic Landry works on email deliverability and DNS configuration at Palisade, from SPF and DKIM records through to DMARC enforcement.

More from Dominic

Related articles and tools