Skip to content

Set Up SPF, DKIM and DMARC for Google Workspace

Step-by-step SPF, DKIM and DMARC setup for Google Workspace, with the exact records, the Admin console steps and how to verify them.

Published 8 min read

To authenticate Google Workspace mail, publish an SPF record with include:_spf.google.com, generate a 2048-bit DKIM key in the Admin console under Apps > Google Workspace > Gmail > Authenticate email and publish it at google._domainkey, then add a DMARC record at _dmarc starting with p=none. SPF and DKIM are DNS changes at your domain host plus one switch in the Admin console. DMARC is DNS only.

This guide walks through each record in order, shows what the values look like, and explains how to confirm each one works before you tighten the policy.

What you need before you start

  • A super administrator account in Google Workspace, or an admin role with the Gmail Settings privilege. DKIM keys cannot be generated without it.
  • Access to DNS for the domain, wherever it is hosted (registrar, DNS provider or CDN). Google Workspace does not host your DNS unless you bought the domain through Google.
  • A list of everything else that sends as your domain. Google covers mail sent from Gmail. Your newsletter tool, CRM, help desk and billing system each need their own setup, covered in the third-party senders guide.

Run a full domain scan first to see what already exists. Adding a second SPF or DMARC record next to an existing one breaks both, so you want to edit, not add.

Step 1: Publish SPF for Google Workspace

If Google is the only service that sends mail for your domain, Google's documented record is:

example.com.  3600  IN  TXT  "v=spf1 include:_spf.google.com ~all"

At most DNS hosts you enter it like this:

Field Value
Type TXT
Name / Host @ (or leave blank for the root)
Value v=spf1 include:_spf.google.com ~all
TTL 3600 or the default

Adding other senders

A domain can have only one SPF record. If another service also sends as your domain, merge its include into the same record instead of creating a second one. Google's own example adds Amazon SES:

example.com.  IN  TXT  "v=spf1 include:_spf.google.com include:amazonses.com ~all"

Each include costs at least one DNS lookup, and nested includes add more. SPF stops working past 10 lookups and returns a PermError. The SPF guide shows how to count them, and the SPF checker counts them for you.

~all or -all?

Google recommends ~all (softfail). Microsoft recommends -all for its tenants. Once DMARC is in place the difference is small: DMARC treats both as "SPF did not pass" and applies your DMARC policy. Start with Google's value. Move to -all later if you want the stricter statement and you are sure every sender is listed.

Google notes that SPF can take up to 48 hours to start working after you publish it.

SPF does not cover subdomains

If you send from mail.example.com or another subdomain, that subdomain needs its own SPF record. The root record does not apply to it.

Step 2: Turn on DKIM signing

Until you set up your own key, Google signs outgoing mail with a default key on a gappssmtp.com domain. That signature passes DKIM, but it does not align with your From domain, so it does nothing for DMARC. You need a key on your own domain.

Generate the key

The steps below match Google's help center as of this writing. Google moves Admin console menus from time to time, so check the current Set up DKIM page if a label differs.

  1. Sign in to the Google Admin console as a super administrator.
  2. Go to Menu > Apps > Google Workspace > Gmail.
  3. Click Authenticate email.
  4. In the Selected domain menu, choose the domain. Each domain and alias domain needs its own key.
  5. Click Generate New Record.
  6. For key length, choose 2048 if your DNS host supports it. Choose 1024 only if your host cannot store a key that long.
  7. Leave the prefix selector as google unless the domain already has a DKIM key with that selector.
  8. Click Generate, then copy the DNS host name and the TXT record value.

Do not click Start authentication yet. Google signs only after it can find the public key in DNS.

If the domain was just added to Google Workspace, the key may not be available yet. Google says you may need to wait 24 to 72 hours after turning on Gmail before you can generate it.

Publish the key

Create a TXT record at your DNS host:

Field Value
Type TXT
Name / Host google._domainkey
Value v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0B...

The full record looks like this in DNS:

google._domainkey.example.com.  IN  TXT  "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA..."

A 2048-bit key is longer than the 255-character limit of a single DNS string. Most DNS hosts split it into several strings automatically, which is correct: receivers join the strings back together. If your host rejects the value, check its TXT length limits before falling back to a 1024-bit key. Google links to guidance on TXT character limits from the setup page.

Two common mistakes at this step:

  • Doubled host name. Many DNS panels append the domain automatically. Entering google._domainkey.example.com can produce google._domainkey.example.com.example.com. Enter only google._domainkey.
  • Pasting only part of the key. The value must include everything from v=DKIM1 to the end of the p= string.

Start signing

  1. Wait until the record resolves. The DKIM checker with selector google shows whether the key is published and readable.
  2. Return to Apps > Google Workspace > Gmail > Authenticate email.
  3. Select the domain and click Start authentication.

When it works, the page status changes to show that email is being authenticated with DKIM. Google notes that a message saying you must update your DNS records can remain for up to 48 hours even when the record is correct.

Step 3: Publish a DMARC record

Google advises waiting 48 hours after setting up SPF and DKIM before you publish DMARC, so that the first reports reflect working authentication.

Start in monitoring mode:

Field Value
Type TXT
Name / Host _dmarc
Value v=DMARC1; p=none; rua=mailto:dmarc@example.com
_dmarc.example.com.  3600  IN  TXT  "v=DMARC1; p=none; rua=mailto:dmarc@example.com"

p=none changes nothing about delivery. It turns on aggregate reporting, which shows every source sending as your domain and whether it passes. Google recommends sending reports to a group or dedicated mailbox rather than a person. The DMARC generator builds the record and checks the syntax.

About Google's example records

Google's help page shows example records that include pct=100, adkim=s and aspf=s. Two notes before you copy them:

  • pct is gone from the current standard. RFC 9989, which replaced RFC 7489, removed pct and added t=y (test mode) as a simpler staging signal. pct=100 was always the default, so leaving it out changes nothing. Receivers still on RFC 7489 ignore t.
  • Strict alignment is optional. adkim=s and aspf=s require an exact domain match. That breaks any sender that signs with a subdomain such as mail.example.com. Relaxed alignment (the default) is the right choice for most domains. The alignment guide explains when strict makes sense.

Step 4: Verify each record

Google's advice is to test with a message to a Gmail or Google Workspace address other than your own. A message to yourself does not show the outside view.

  1. Send a message from a Workspace user to a personal Gmail address.
  2. Open it and choose Show original.
  3. Check the summary at the top and the Authentication-Results header.

A correctly configured domain looks like this:

Authentication-Results: mx.google.com;
       dkim=pass header.i=@example.com header.s=google header.b=AbCd1234;
       spf=pass (google.com: domain of jane@example.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jane@example.com;
       dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=example.com

What to look for:

  • dkim=pass with header.i=@example.com and header.s=google: your own key is signing, not the default one.
  • spf=pass with smtp.mailfrom on your domain: SPF is aligned.
  • dmarc=pass with header.from=example.com: the policy is found and at least one aligned check passed.

The email headers guide covers the other fields. You can also check the published records directly with the DMARC checker.

Step 5: Read reports and move to enforcement

Aggregate reports usually start arriving within a day or two. Expect Google mail to pass cleanly from the start. The work is in the other sources the reports reveal: a marketing platform using its own bounce domain, a CRM signing with its own DKIM domain, a website form sending through an unauthenticated relay.

Fix each one, then raise the policy:

_dmarc.example.com.  IN  TXT  "v=DMARC1; p=quarantine; rua=mailto:dmarc@example.com"

and finally:

_dmarc.example.com.  IN  TXT  "v=DMARC1; p=reject; rua=mailto:dmarc@example.com"

The full rollout, including how long to stay at each stage, is in how to set up DMARC. The policy comparison explains what each level does to failing mail.

Gmail also enforces its own sender requirements. If you send more than 5,000 messages a day to Gmail accounts, you need SPF, DKIM and DMARC (p=none is enough to qualify), aligned From domains and one-click unsubscribe on marketing mail. See Google and Yahoo sender requirements.

Alias domains and secondary domains

Each domain that appears in a From address needs its own records:

Record Where Shared with the primary domain?
SPF Root of each domain No, publish one per domain
DKIM google._domainkey per domain No, generate a key per domain
DMARC _dmarc per domain No, publish one per domain

Domains you own but do not send from need a lockdown instead. The subdomains and parked domains guide has the records.

Troubleshooting

  • DKIM shows d= on a gappssmtp.com domain. Signing with your key is not on. Click Start authentication, or check that the TXT record resolves.
  • dkim=fail with "no key". The selector in the signature does not match a published record. Check the host name for a doubled domain.
  • SPF PermError. Too many lookups or two SPF records. Merge records and remove unused includes.
  • DMARC passes for Gmail mail but fails for other sources. Expected. Those senders need their own aligned SPF or DKIM.
  • No reports arrive. Check the rua address, and if it is on another domain, that domain must authorize it with a _report._dmarc record.

Once all three records are published, run a full domain check to confirm SPF, DKIM and DMARC in one pass.

Check your domain now