---
title: "How to set up DKIM: eight steps and a real test · dkim.fyi"
description: "Set up DKIM in eight steps: find every sender, publish the records, check whether signing needs a switch, then test a real message and check alignment."
url: "https://dkim.fyi/guides/how-to-set-up-dkim"
last_verified: 2026-10-29
---

# How to set up DKIM: eight steps and a real test

Guide · https://dkim.fyi/guides/how-to-set-up-dkim · Last verified 2026-10-29

Setting up DKIM follows the same loop at most sending services. The service usually makes a key pair, you publish the public half in DNS at `<selector>._domainkey.<domain>`, you turn signing on if the service asks you to, and you send a new message to see what arrives.

Three checks stay separate along the way: the record exists, the signature on one message verifies, and the signing domain aligns with the From domain ([What is DKIM](https://dkim.fyi/guides/what-is-dkim) explains the difference). dkim.fyi makes the first two and compares two domain names for the third. Checked on 29 October 2026.

## The eight steps

Work through these in order for each service that sends mail as your domain.

1. List every service that sends mail as your domain.
2. Open each service’s DKIM settings and copy the record it generates.
3. Publish those records in your DNS.
4. Check whether signing needs a switch.
5. Send a new test message from the service.
6. Read the authentication results for that message.
7. Compare the signing domain (d=) with the From domain.
8. Recheck after any change to senders, gateways, your DNS host or keys.

## Step 1: list every service that sends as your domain

List each system that puts your domain in the From address: your mailbox provider, a marketing platform, a support desk, an application that sends by SMTP or an API. Several senders can each use their own selector and key, so one setup says nothing about the next.

If you cannot name them all, the [DKIM selector finder](https://dkim.fyi/discover) reads the domain’s MX, SPF and DMARC records and tries known selectors.

> **A miss in the selector finder is not proof**
>
> A DKIM key is looked up by its exact name (RFC 6376), so the finder tries only names it knows, and a service that generates its own selector may not be on the list. [Find a DKIM selector without an email header](https://dkim.fyi/guides/find-selector-without-header) shows how to read the real one from a message.

## Steps 2 and 3: copy the record and publish it

Copy the record name and value from the sending service’s own DKIM page and publish them exactly as shown. No generic page can print your values, because many services generate the selector or the target for each account.

**Record type each provider page gives, by what the provider generates**

| Record type | Providers | What the provider gives you |
| --- | --- | --- |
| CNAME | [Fastmail](https://dkim.fyi/providers/fastmail), [HubSpot](https://dkim.fyi/providers/hubspot), [Klaviyo](https://dkim.fyi/providers/klaviyo), [Mailchimp Transactional](https://dkim.fyi/providers/mailchimp-transactional), [Microsoft 365](https://dkim.fyi/providers/microsoft-365), [Proton Mail](https://dkim.fyi/providers/proton-mail), [SendGrid](https://dkim.fyi/providers/sendgrid), [Zendesk](https://dkim.fyi/providers/zendesk) | A CNAME that points at a name the provider gives you. SendGrid gives TXT when automated security is off, and Klaviyo’s Dynamic routing uses NS. |
| TXT | [Cloudflare Email Routing](https://dkim.fyi/providers/cloudflare-email-routing), [Google Workspace](https://dkim.fyi/providers/google-workspace), [Postmark](https://dkim.fyi/providers/postmark), [Zoho Mail](https://dkim.fyi/providers/zoho-mail) | A TXT record that holds the public key. |
| TXT or CNAME | [Amazon SES](https://dkim.fyi/providers/amazon-ses), [Brevo](https://dkim.fyi/providers/brevo), [Mailgun](https://dkim.fyi/providers/mailgun) | Either, by method or account. SES uses CNAMEs (Easy DKIM) or one TXT (BYODKIM), Brevo CNAMEs or one TXT, Mailgun CNAMEs (Automatic Sender Security) or a TXT for a manual key. |

Each provider page was last checked on 2026-10-10 (Amazon SES, Google Workspace, Mailgun, Microsoft 365, SendGrid) or 2026-10-24 (the rest).

Google Workspace generates the key in the Admin console (“Click the Generate New Record button.”). The default selector is `google`, the record is TXT, and Google offers 2048 bits where your DNS host supports it and 1024 where it does not. After Gmail is turned on for the organization, you wait 24 to 72 hours before you can get the key there. Microsoft 365 uses two CNAMEs, `selector1._domainkey` and `selector2._domainkey`, the same in every organization, and `New-DkimSigningConfig` makes a 1024-bit key unless you ask for 2048.

On key size, RFC 8301 says “Signers SHOULD use RSA keys of at least 2048 bits.” Google’s sender guidelines say “Sending to personal Gmail accounts requires a DKIM key of 1024 bits or longer.”

## Add the record at any DNS host

This checklist gives no host-specific syntax, because hosts differ. Three things apply at most DNS hosts.

1. Name the record `<selector>._domainkey`. Hosts differ on whether your domain goes on the end, so after saving, run the [DKIM checker and record lookup](https://dkim.fyi/) with your domain and the selector. It looks up exactly `<selector>._domainkey.<domain>`, so a record saved under another name shows as not found. [The DKIM record reference](https://dkim.fyi/guides/dkim-record-reference) explains the tags in the value.
2. Check the length limit, if your host has one. Google says “You can not enter a 2048-bit key as a single text string with a 255-character TXT record limit.” A TXT record can hold more than one string, and RFC 6376 says “Strings in a TXT RR MUST be concatenated together before use with no intervening whitespace.” Ask your host how it takes a long value. The checker shows the joined value, not where it was split.
3. Allow time. Google Workspace says “After adding a DKIM key, it can take up to 48 hours for DKIM authentication to start working.” The checker also keeps DNS answers for up to five minutes, so a record you just saved may not show at once.

## Step 4: check whether signing needs a switch

At some services publishing the record is not enough. [Google Workspace](https://dkim.fyi/providers/google-workspace) has a separate control: once the TXT record is in place, “Click Start authentication.” When it works, the status reads “Authenticating email with DKIM”.

[Microsoft 365](https://dkim.fyi/providers/microsoft-365) has a DKIM toggle in the Defender portal. It does not enable while the CNAME is missing, and the status stays `CnameMissing`. Signing can also be switched on with only one of the two records published, and a later key rotation then fails because the second record is missing.

Other services start signing on their own. [Proton Mail](https://dkim.fyi/providers/proton-mail) and [Postmark](https://dkim.fyi/providers/postmark) start when they detect or verify the record.

## Steps 5 to 7: test with a real message

Use a message sent after step 4, so it reflects the setup you just finished.

Step 5 is a new message to an address where you can see the headers. Google notes “You can’t verify DKIM is on by sending yourself a test message.” The [DKIM test with a real email](https://dkim.fyi/email) gives you a throwaway address for up to 20 messages in 24 hours. Press “Get an address”, send anything to it from the service, and each signature appears with its `s=` and `d=` values.

Step 6 is the verdict. The email test shows whether the header signature verified. The mailbox that received a message records its own verdict in an `Authentication-Results` header. In Gmail, click More next to Reply, then Show original. Google says the DKIM results “should say something like DKIM=pass or DKIM=OK”, and that if the header “doesn’t include a line about DKIM, messages sent from your domain aren’t signed with DKIM”. [Read DKIM authentication results](https://dkim.fyi/guides/read-dkim-authentication-results) explains the values.

Step 7 compares two names. A message can carry a valid signature from any domain, so DMARC also requires the signing domain to align with the From domain. The same Organizational Domain is relaxed alignment and identical names are strict alignment (RFC 9989). In its Table 1, a signing domain of `foo.example.com` is relaxed against a From domain of `news.example.com`, `news.example.com` is strict against itself, and `foo.example.net` does not align. [DKIM, SPF and DMARC compared](https://dkim.fyi/guides/dkim-vs-spf-vs-dmarc) shows where DKIM fits.

> **What the email test does not show**
>
> It reads only the header block, so the body hash is never checked. Each signature says “Body hash not checked: the body is never read”, and “Header signature: verified” says nothing about the body.
>
> The line “Aligned with the From domain (strict)” compares two domain names. It does not use adkim, aspf or the DMARC policy. Its relaxed match uses a built-in list of 34 second-level suffixes, not the Public Suffix List.
>
> With only a header block and an aligned signature whose key and header signature check out, the tool reports “A signature aligned with <domain> is present, but without the message body its body hash cannot be checked, so this analysis cannot say whether DKIM satisfies DMARC.” To check the body hash, paste the complete received message into the [DKIM header analyzer and signature verifier](https://dkim.fyi/message).

## Step 8: recheck after every change

Repeat steps 5 to 7 when you add or remove a sending service, put a gateway in the mail path, move your DNS host or change a key. Google warns that “some outbound gateways add a footer to the bottom of every outgoing message. This can cause DKIM to fail because message contents are changed after the message was sent.”

RFC 6376 advises a new selector for each new key: “Signers are ill-advised to reuse selectors for new keys. A better strategy is to assign new keys to new selectors.” So after a key change, take the selector from a new message. At Microsoft 365 a rotation takes four days (96 hours) to start signing, so test again after that.

**The checker found my record. Is my mail signed?**

Not necessarily. The checker shows that a key is published at that name, not that any message is signed with it, and signing may not have started yet (step 4).

**I set up several services. Does one good test cover them all?**

No. A message carries the signatures its own sender added, so a test from one service says nothing about another. Send one new message from each service.

## Try it

- [Validate a selector](https://dkim.fyi/)
- [Scan a domain for known selectors](https://dkim.fyi/discover)
- [Send a test message](https://dkim.fyi/email)
- [Paste a full message](https://dkim.fyi/message)

## Sources

1. [Set up DKIM | Security & data protection | Google Workspace Help](https://knowledge.workspace.google.com/admin/security/set-up-dkim)
2. [Troubleshoot DKIM issues | Security & data protection | Google Workspace Help](https://knowledge.workspace.google.com/admin/security/troubleshoot-dkim-issues)
3. [Email sender guidelines - Gmail Help](https://support.google.com/a/answer/81126)
4. [How to use DKIM for email in your custom domain - Microsoft Defender for Office 365 | Microsoft Learn](https://learn.microsoft.com/en-us/defender-office-365/email-authentication-dkim-configure)
5. [Anti-spoofing for custom domains (SPF, DKIM, and DMARC)](https://proton.me/support/anti-spoofing-custom-domain)
6. [How do I set up DKIM for Postmark? | Postmark Support Center](https://postmarkapp.com/support/article/1091-how-do-i-set-up-dkim-for-postmark)
7. [RFC 1035: Domain names - implementation and specification](https://www.rfc-editor.org/rfc/rfc1035)
8. [RFC 6376: DomainKeys Identified Mail (DKIM) Signatures](https://www.rfc-editor.org/rfc/rfc6376)
9. [RFC 8301: Cryptographic Algorithm and Key Usage Update to DomainKeys Identified Mail (DKIM)](https://www.rfc-editor.org/rfc/rfc8301)
10. [RFC 9989: Domain-Based Message Authentication, Reporting, and Conformance (DMARC)](https://www.rfc-editor.org/rfc/rfc9989)

---

This is the text version of https://dkim.fyi/guides/how-to-set-up-dkim. The index of every page is https://dkim.fyi/llms.txt.
