Suped

What is the 'q' tag in a DKIM record?

When you're setting up email authentication, you'll inevitably come across DKIM, which stands for DomainKeys Identified Mail. It's a critical standard that helps prevent email spoofing. At its core, DKIM works by adding a digital signature to your outgoing emails. Receiving servers can then verify this signature using a public key published in your domain's DNS records. This DKIM record, a specific type of DNS TXT entry, is made up of several parts called 'tags'. These tags are essentially instructions that tell the receiving server details about the signature.

www.nslookup.io logo
NsLookup.io says:
Visit website
DKIM records are TXT record that contain tag/value pairs. The tag's name is followed by an equals sign and then the tag's value.

One of the less common tags you might see is the 'q' tag. While essential tags like v= (version) and p= (public key) are always present, the 'q' tag is optional and often omitted. Let's explore what it does and why it exists.

Suped DMARC monitor
Free forever, no credit card required
Get started for free
Trusted by teams securing millions of inboxes
Company logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logoCompany logo

What is the function of the 'q' tag?

The 'q' tag in a DKIM record specifies the 'query method'. It tells the receiving mail server how it should retrieve the public key needed to verify the email's signature. It's a mechanism designed to provide flexibility in how keys are located, though in practice, its usage is very standardized.

www.duocircle.com logo
DuoCircle says:
Visit website
'q' tag (optional) ... It stands for the 'query method' tag and defines the method used to retrieve the public key. Typically, this is dns/txt.

The value for this tag is almost always q=dns/txt. This indicates that the public key is stored in the Domain Name System (DNS) as a TXT record. Since this is the standard and universally adopted method for publishing DKIM keys, the 'q' tag is often left out of the record entirely. If the tag is absent, receiving servers will default to using the 'dns/txt' method anyway.

  • Purpose: The 'q' tag specifies the mechanism for looking up the DKIM public key.
  • Default Value: The standard and default value is dns/txt.
  • Optionality: Because dns/txt is the default, the 'q' tag is considered optional and is not required for a valid DKIM record.

Why does the 'q' tag even exist?

The inclusion of the 'q' tag in the original DKIM specification, RFC 6376, was a forward-thinking measure. The designers anticipated that there might be other ways to store and retrieve public keys in the future. By including a query method tag, they made the standard extensible. For instance, a new technology for key retrieval could be introduced without needing to overhaul the entire DKIM framework. A new query method could simply be defined and used.

www.techtarget.com logo
Search Security says:
Visit website
This tag can be used to include a comma-separated list of query methods that can be used to retrieve the sending email server's public key.

However, in the years since DKIM was established, no other widely adopted query methods have emerged. The DNS has proven to be a reliable and scalable system for this purpose, so dns/txt remains the only method in common use. As a result, the 'q' tag is mostly a historical artifact of a well-designed, future-proofed protocol.

Example of the 'q' tag in a DKIM record

Here is what a simplified DKIM record might look like with the 'q' tag explicitly defined:

v=DKIM1; k=rsa; q=dns/txt; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC...; s=selector1; d=example.com;

In this example, q=dns/txt explicitly tells the verifier to perform a DNS lookup for the TXT record. If you removed q=dns/txt, the outcome would be the same, as this is the default behavior.

Should I add it to my DKIM record?

For most people, there is no need to manually add the 'q' tag to your DKIM record. The vast majority of email service providers and DNS management tools that generate DKIM records for you will either omit it for brevity or include it with the standard dns/txt value. Both configurations are perfectly valid and will not cause any issues with your email deliverability.

In summary, the 'q' tag is a small but interesting piece of the DKIM puzzle. It defines the query method for finding the public key, and while it was designed for future flexibility, its role has been firmly cemented in the standard DNS lookup process. You can safely ignore it in most practical applications, knowing that the default behavior is exactly what's needed for modern email authentication.

Start improving your email deliverability today

Get started