Set up SPF, DKIM and DMARC for Google Workspace

Step-by-step: the exact SPF record, how to generate and publish the DKIM key in the Google Admin console, and a safe first DMARC record for a Google Workspace domain.

Updated

Want to see where your domain stands before you start? Check your domain

Google Workspace signs and authenticates mail for your domain once three DNS records are in place. This guide walks through them in the order that avoids surprises: SPF first, DKIM second, DMARC last. Allow 30 minutes plus DNS propagation time.

Before you start

You need:

Check what already exists before changing anything: run the DMARC, SPF and DKIM checker on your domain and keep the result open.

Step 1: SPF

SPF lists the servers allowed to send mail for your domain. Google publishes its list under _spf.google.com, so the record is one line.

  1. In your DNS host, open the records of your domain.
  2. If a TXT record starting with v=spf1 already exists, edit it. Never add a second one: two SPF records cancel each other.
  3. Create or edit the TXT record:
Host / Name Type Value
@ (the bare domain) TXT v=spf1 include:_spf.google.com ~all

If other services send mail for you, add their include before ~all, for example v=spf1 include:_spf.google.com include:servers.mcsv.net ~all for Mailchimp. Every include costs DNS lookups and the total is capped at 10; the SPF checker counts them for you.

~all (softfail) is Google’s recommendation. -all (fail) is stricter and fine once you are sure every sender is listed.

Step 2: DKIM

DKIM adds a cryptographic signature to every message Google sends for you. The public key lives in your DNS under the selector google.

  1. Open the Admin console → Apps → Google Workspace → Gmail → Authenticate email.
  2. Select your domain in the drop-down and click Generate new record.
  3. Keep the key length at 2048 bits and the selector prefix google, then click Generate. (Choose 1024 bits only if your DNS host refuses long TXT values; most hosts split long values automatically.)
  4. Google shows a host name and a TXT value. Publish them:
Host / Name Type Value
google._domainkey TXT v=DKIM1; k=rsa; p=MIIBIjANBg… (the full value shown by Google)
  1. Wait until the record is visible. Check it with the DKIM checker using the selector google; it should report a 2048-bit key.
  2. Back in Authenticate email, click Start authentication. The status changes to Authenticating email.

Google says propagation can take up to 48 hours; in practice the checker usually sees the record within minutes. If you click Start authentication before the record is visible, Google shows an error. Wait and try again.

Step 3: DMARC

DMARC tells receivers what to do when a message fails SPF and DKIM alignment, and asks them to send you reports. Start in monitoring mode so nothing is blocked yet.

Host / Name Type Value
_dmarc TXT v=DMARC1; p=none; rua=mailto:dmarc-reports@yourdomain.com

Replace yourdomain.com with your domain and make sure the mailbox (or group) exists: reports start arriving within 24 to 48 hours as XML attachments. How to read a DMARC report explains what they contain.

After two to four weeks of clean reports, move to p=quarantine, then p=reject, following From p=none to p=reject. Google requires bulk senders (5,000 messages a day or more to Gmail) to have DMARC with at least p=none, aligned SPF or DKIM, and a working unsubscribe link.

Step 4: Verify with a real message

  1. Send a message from your Google Workspace account to a personal Gmail address.
  2. In Gmail, open the message menu → Show original.
  3. The summary at the top must show SPF: PASS, DKIM: PASS with your domain, and DMARC: PASS.

Then run the checker once more: SPF should pass with one lookup, DKIM should show the google selector with a 2048-bit key, and DMARC should show your policy.

Common problems

Check your work. Run the checker on your domain: it reads the live DNS records and tells you what is still missing.