How do you set up DKIM for your email domain?

Brass wax seal stamp pressing an authentication mark into burgundy wax on a cream envelope atop a dark desk beside a glowing laptop.

To set up DKIM for your email domain, you generate a public/private key pair, publish the public key as a TXT record in your DNS, and configure your email sending platform to sign outgoing messages with the private key. The entire process typically takes 30 to 60 minutes, though DNS propagation can add a few hours before the setup becomes fully active. The sections below walk through each step in detail, from prerequisites to troubleshooting common failures.

What does DKIM actually do to your outgoing emails?

DKIM (DomainKeys Identified Mail) adds a cryptographic digital signature to every outgoing email your domain sends. That signature is attached to the message header, allowing the recipient’s mail server to verify that the email genuinely came from your domain and that its content was not altered in transit. This verification step is a core pillar of modern email authentication.

When your mail server sends a message, it uses a private key stored securely on the server to generate a unique hash of specific email headers and the message body. That hash is embedded in the email as a DKIM signature. On the receiving end, the recipient’s mail server queries your DNS for the corresponding public key, decrypts the signature, and checks whether the hash matches the message it received. If everything lines up, the email passes DKIM authentication.

Passing DKIM does several things for your sender reputation. It gives inbox providers like Gmail and Microsoft a trusted signal that your domain is legitimate, which improves deliverability. It also satisfies one of the two alignment requirements for DMARC, meaning DKIM setup is not just about authentication in isolation but is part of a broader compliance framework that protects your domain from spoofing and phishing attacks.

What do you need before setting up DKIM?

Before you can configure DKIM, you need access to three things: your DNS management interface, your email sending platform’s admin settings, and a clear understanding of which domain you are authenticating. Without DNS access, you cannot publish the public key that makes DKIM work.

Here is a practical checklist to confirm you are ready to proceed:

  • DNS access: You need the ability to create TXT records on your sending domain. This is managed through your domain registrar (such as GoDaddy or Namecheap) or a DNS provider (such as Cloudflare).
  • Email platform admin access: Whether you are using an ESP like Mailchimp, a CRM, or your own mail server, you need admin-level access to generate or retrieve your DKIM keys.
  • Your sending domain confirmed: Know exactly which domain or subdomain your emails are sent from. If you send from a subdomain like mail.yourdomain.com, the DKIM record goes on that subdomain, not the root.
  • A DKIM selector chosen: A selector is a short label (like s1 or mailjet) that distinguishes your DKIM key from others on the same domain. Many platforms assign one automatically.

If you are setting up DKIM on a shared hosting environment or a third-party ESP, check whether the platform generates the key pair for you. Most modern platforms handle key generation internally and simply ask you to copy a DNS record they provide.

How do you generate a DKIM key pair for your domain?

To generate a DKIM key pair, you either use the built-in DKIM setup tool inside your email sending platform or generate the keys manually using an open-source tool like OpenSSL. For the vast majority of senders, the platform-generated approach is simpler, faster, and less error-prone.

Using your email platform to generate the key pair

Most ESPs and marketing platforms have a dedicated DKIM or email authentication section in their settings. Navigate to your account’s domain authentication or sending domain settings, enter your domain, and the platform will generate both keys automatically. It will then display the public key formatted as a DNS TXT record, ready for you to copy and paste into your DNS.

Generating keys manually with OpenSSL

If you manage your own mail server (such as Postfix or Exim), you will generate the key pair manually. The standard approach uses a 2048-bit RSA key, which is the current recommended minimum length for strong DKIM security. Run the OpenSSL commands to produce the private key file and the corresponding public key, then format the public key into the correct DNS TXT record syntax. Store the private key securely on your mail server and never expose it publicly.

Regardless of the method, use a 2048-bit key length where possible. Some older DNS providers have TXT record length limitations that force senders to use 1024-bit keys, but 2048-bit is strongly preferred in 2026 given the increasing scrutiny inbox providers apply to sender authentication signals.

How do you add a DKIM record to your DNS?

To add a DKIM record to your DNS, log in to your DNS provider, create a new TXT record, set the host name to your selector followed by ._domainkey.yourdomain.com, and paste the public key value your email platform provided. Save the record and allow time for DNS propagation.

Here is the step-by-step process:

  1. Log in to your DNS management interface. This is wherever your domain’s DNS zone is managed, not necessarily your registrar.
  2. Create a new TXT record. Select TXT as the record type.
  3. Set the host name (Name field). Enter your selector and domain in this format: selector._domainkey. If your domain is example.com and your selector is s1, the full host name is s1._domainkey.example.com. Some DNS interfaces only require the portion before the domain, so enter s1._domainkey in that case.
  4. Paste the public key value. The value field should contain the full key string beginning with v=DKIM1;. Copy this exactly from your email platform without any line breaks.
  5. Set TTL. A TTL of 3600 seconds (one hour) is standard. Lower values allow faster updates if you need to rotate keys later.
  6. Save the record. DNS changes propagate globally within minutes to 48 hours, though most providers update within a few hours.

Double-check the record after saving by looking it up in your DNS interface. A misplaced character or an extra space in the key value is one of the most common causes of DKIM failures.

How do you verify that DKIM is working correctly?

To verify that DKIM is working, send a test email and inspect the message headers for a DKIM pass result, or use a dedicated DNS lookup and email testing tool to confirm your record is correctly published and your signatures are valid.

There are several reliable ways to check:

  • Send to a Gmail address and check headers: Open the email in Gmail, click the three-dot menu, and select “Show original.” Look for dkim=pass in the Authentication-Results header near the top of the raw message.
  • Use MXToolbox: The MXToolbox DKIM lookup tool lets you enter your domain and selector to confirm the DNS record is published and correctly formatted.
  • Use Mail-Tester.com: Send an email to the address Mail-Tester provides and receive a full authentication report including DKIM, SPF, and DMARC results.
  • Check your ESP’s authentication dashboard: Many platforms display a green checkmark or “authenticated” status once they confirm the DNS record is live and the keys match.

If your test shows dkim=pass and the signing domain aligns with your From address domain, your DKIM setup is functioning correctly. At that point, consider verifying your DMARC policy as well, since DKIM and DMARC work together to fully protect your domain.

Why might DKIM fail even after a correct setup?

DKIM can fail after a correct setup due to DNS propagation delays, message modification in transit, key mismatches between the published record and the signing configuration, or email forwarding that alters the message before it reaches the final recipient.

The most common causes of post-setup DKIM failures include:

  • DNS propagation not yet complete: If you check DKIM within minutes of publishing the record, the change may not have propagated globally. Wait at least a few hours before concluding there is a problem.
  • Truncated or broken TXT record: Long DKIM public keys sometimes get cut off during copy-paste or by DNS providers with character limits. Verify the full key value is intact in your DNS record.
  • Selector mismatch: If the selector your mail server uses to sign emails does not match the selector in the DNS record name, the lookup fails. Confirm both use the same selector string.
  • Email modification by mailing lists or forwarding services: Some mailing list managers and email forwarders modify the message body or headers, which breaks the cryptographic hash. This is a known limitation of DKIM and is one reason DMARC allows SPF alignment as an alternative pass mechanism.
  • Key rotation without updating DNS: If you rotate your private key on the mail server but forget to update the corresponding public key in DNS, all outgoing signatures will fail validation until the DNS record is updated.
  • Multiple DKIM records for the same selector: Publishing duplicate TXT records under the same selector can cause lookup failures. Each selector must map to exactly one TXT record.

When diagnosing a DKIM failure, always start with the raw email headers from a test message. The Authentication-Results header will often tell you whether the failure was a DNS lookup error, a signature mismatch, or a body hash failure, which points you directly to the root cause.

How Email Industries helps with DKIM setup and email authentication

Getting DKIM right is straightforward in theory but easy to get wrong in practice, especially across complex sending environments with multiple domains, subdomains, or third-party platforms. That is where we come in. At Email Industries, we help organizations implement and validate their full email authentication stack, including DKIM, SPF, and DMARC, as part of our broader deliverability work. Here is what we bring to the table:

  • Authentication audits: We review your current DNS records, identify misconfigurations, and confirm that your DKIM keys are correctly published and actively signing outgoing mail.
  • End-to-end implementation support: Whether you are setting up DKIM for the first time or troubleshooting a persistent failure, our team works through the technical details with you step by step.
  • DMARC alignment verification: We confirm that your DKIM setup aligns with your DMARC policy so your domain is fully protected against spoofing and phishing.
  • Ongoing monitoring: Through our Deliverability Assurance Packages, we keep an eye on your authentication health over time, catching issues before they affect inbox placement.
  • Broader deliverability consulting: DKIM is one piece of a larger puzzle. Our services cover the full spectrum of deliverability challenges, from reputation repair to list hygiene and compliance.

If you are not confident your DKIM setup is working the way it should, or if you want an expert set of eyes on your full authentication configuration, feel free to contact us, and we will take it from there.

Related Articles

Share the Post

Related Posts

The Best Senders Read This – Do You?

Get expert-backed strategies, real-world case studies, and insider email deliverability tips straight to your inbox. Join the Inbox Insiders.