Skip to content
SendPath

Guide

SPF record for Google Workspace

Here is the exact SPF record for Google Workspace, where to add it and how to check it. Copy it, add it as a TXT record at the root of your domain, and keep to one SPF record per domain.

TXT record for Google Workspace

v=spf1 include:_spf.google.com ~all

  • Type: TXT
  • Host: @, which means the root of your domain
  • Records per domain: one. If you already have an SPF record, merge into it (below).

What the record says

  • v=spf1 marks the record as SPF, version 1.
  • include:_spf.google.com adds Google’s own list of sending servers, so mail sent through Google Workspace is allowed.
  • ~all covers everything else. It tells receiving servers to treat mail from a server that is not on the list with suspicion (a soft fail), and Google recommends it. -all asks for outright rejection; use it only once every sender is listed.

Where to add it

You add it where your domain’s DNS is managed. That is often your registrar, such as Namecheap or GoDaddy, or a service like Cloudflare.

  1. Sign in there and open the DNS records for your domain.
  2. Add a new record of type TXT.
  3. Set the host to @ and paste the record as the value. If you send from a subdomain, use the subdomain’s name as the host: each subdomain needs its own SPF record.
  4. Save it.

It often shows up much sooner, but allow up to 48 hours, as Google’s own help says, before you decide it is not working.

If you already have an SPF record

Do not add a second one. Two SPF records make SPF fail for both. Merge them into one record: a single v=spf1 at the start, every include: from both records in the middle, and a single ~all at the end.

Example with one other sender (replace the placeholder)

v=spf1 include:_spf.google.com include:sender.example.com ~all

Check it

Type your domain into the SPF checker to see the record, that there is only one and that it ends safely. If you would rather build the record than edit it by hand, the SPF record generator has Google Workspace and other providers as options. The domain check looks at SPF, DKIM, DMARC and MX in one run.

Look it up from a terminal

You can read any domain’s SPF record without a website. On Windows, macOS or Linux, run nslookup -type=TXT yourdomain.com; on macOS and Linux, dig TXT yourdomain.com +short prints the same. Look for the line that starts with v=spf1. If two lines start that way, you have the two-record problem.

What the result means

Send a note to a Gmail address of your own, open it, and choose Show original. Gmail shows an SPF result at the top:

Gmail showsWhat it meansWhat to do
spf=passThe sending server is on your list.Nothing. Check DKIM and DMARC next.
spf=softfailThe server is not on your list, and your record ends in ~all.Add the service that sent it to your record.
spf=failThe server is not on your list, and your record ends in -all.Add the sender, or find out who is sending as you.
spf=neutralYour record says nothing either way (it ends in ?all).Change the ending to ~all.
spf=permerrorThe record cannot be read: usually two SPF records, or more than 10 DNS lookups.Merge to one record and trim the includes.
spf=noneNo SPF record was found for the domain.Add the record from this page.
spf=temperrorA temporary DNS problem stopped the check.Usually clears on its own; send another test later.

A worked example

This is an illustration. A team sends from Google Workspace and has just added a newsletter tool that sends as their domain. Their record is still v=spf1 include:_spf.google.com ~all, so the newsletter’s mail shows spf=softfail. The tool’s help page gives them an include, say include:sender.example.com. They edit the one record they have, never adding a second: v=spf1 include:_spf.google.com include:sender.example.com ~all. After DNS updates they send another test, and it shows spf=pass. Each new sender adds an include and, behind it, more DNS lookups, which is why the limit of 10 matters: Google’s include already uses several of them.

When SPF alone will not help

  • Forwarded mail. When someone forwards your email, the forwarding server is not in your record, so SPF can fail even though you did everything right. DKIM usually survives forwarding, which is why you need both.
  • The visible From address. SPF checks the hidden sending address (the envelope sender), not the From name people see. DMARC is what ties the two together.
  • A bad list or a spammy message. A perfect record does not make mail with those problems reach the inbox. See why emails go to spam for the other eight causes.

Common mistakes

  • Two SPF records. Merge them into one.
  • More than 10 DNS lookups. Each include: counts, and so do the lookups inside it. Over the limit, SPF fails.
  • Ending in +all. That allows anyone to send as your domain.
  • Forgetting a sender. A CRM, a newsletter tool or a sending service that sends as your domain needs its own include: in the same record.
  • Expecting SPF alone to fix spam. It is one of three records; DKIM and DMARC matter as much.

Next steps

SPF is the first of three records. Check DKIM with the DKIM checker and DMARC with the DMARC checker, and see the docs page DNS records for how each one works.

Related

Check your whole setup in one run: SPF, DKIM, DMARC and MX.

FAQ

Questions, answered

Why does Gmail show spf=softfail?+

The server that sent the message is not on your SPF record, and your record ends in ~all. Find which service sent it (the message's Show original page lists the sending server) and add that service's include to your one SPF record.

Does SPF check the From address people see?+

No. SPF checks the hidden envelope sender, not the visible From name and address. DMARC checks that the domain in the visible From address lines up with the domain SPF or DKIM verified, which is why SPF alone is not enough.

Why does SPF fail when someone forwards my email?+

The forwarding server is not on your record, so the check fails for the forwarded copy. DKIM normally survives forwarding, so set up both.

Should I use ~all or -all?+

Start with ~all, which Google recommends. It tells receiving servers to treat mail from a server that is not on your list with suspicion. Switch to -all, which says to reject it, only once you are sure every service that sends for you is listed.

Do I need SPF if I use Gmail?+

If you send from a free @gmail.com address, Google manages SPF for gmail.com and you have nothing to add. SPF is for your own domain: if you send from [email protected] through Google Workspace, you add the record.

How many SPF records can I have?+

One per domain. With two, SPF fails for both, so merge them into a single record that lists every sender.

All guides