Authentication and DNS
DNS TXT record
A DNS TXT record is a line of text stored in your domain's settings. Mail servers read TXT records to check SPF, DKIM and DMARC. Other services read them to confirm that you own the domain.
What is a DNS TXT record?
A DNS TXT record is a line of text stored in your domain's settings. Anyone on the internet can read it.
First, what DNS is. DNS stands for Domain Name System. It works like a public phone book for domains. When someone types your domain, DNS tells their computer where to find it. DNS holds different types of entries, called records. Each record type has one job.
A TXT record holds plain text. It does not send anyone anywhere. It is a note attached to your domain. Other systems read the note and act on it.
What TXT records are used for
In email, TXT records hold the rules that prove your emails are real.
| Use | Where the record goes | Example value |
|---|---|---|
| SPF | your domain, for example example.com | v=spf1 include:_spf.google.com ~all |
| DKIM | selector._domainkey.example.com | v=DKIM1; k=rsa; p=MIIBIjANBg... |
| DMARC | _dmarc.example.com | v=DMARC1; p=none; rua=mailto:reports@example.com |
| Domain ownership | your domain | google-site-verification=abc123... |
The values above are shortened examples. Your real values come from your email provider or the service you are connecting.
A simple example
Here is how a TXT record is added.
- Marco starts using Google Workspace. He wants his emails from marco@studio.example to reach inboxes.
- Google gives him a value. The setup guide tells him to add an SPF record with
v=spf1 include:_spf.google.com ~all. - Marco opens his domain settings. He logs in where he bought the domain. This is called the registrar or DNS host.
- He adds a TXT record. He chooses the type TXT, leaves the name as his domain and pastes the value.
- He waits. The change can take from a few minutes to a few hours to show everywhere.
- Servers can now check him. When Marco sends an email, the receiving server reads his TXT record. It sees that Google's servers are allowed to send for studio.example.
Rules that break TXT records
Most problems with TXT records come from a few simple mistakes.
- Only one SPF record per domain. If a domain has two TXT records that start with
v=spf1, SPF fails. Join them into one record instead. - Long values are split. One piece of text in a TXT record can hold up to 255 characters. Long values, such as DKIM keys, are stored as several pieces. Most DNS hosts do this for you.
- Use the exact name. A DMARC record must sit at
_dmarc, not at your main domain. A DKIM record must sit at the selector name your provider gives you. - Copy the value exactly. One missing character makes the record useless.
How to check a TXT record
You can read the TXT records of any domain. On a Mac or Linux computer, open the terminal and type dig TXT example.com. On Windows, type nslookup -type=TXT example.com.
You can also use our SPF checker. It reads the SPF record of a domain and explains what it allows.
How TXT records relate to verification
TXT records protect the email you send. They prove the email comes from you. They say nothing about whether the person you write to still has a mailbox.
That is a different check. An email checker asks the receiving server whether an address exists. You need both: correct records on your domain, and a clean list of real addresses.
Related terms
- SPF recordAn SPF record is a line of text on your domain that lists the servers allowed to send email for that domain. Receiving servers check it to confirm that an email claiming to come from your domain was sent by one of your servers.
- DKIMDKIM stands for DomainKeys Identified Mail. It adds a digital signature to every email you send. The receiving server checks the signature to confirm the email came from your domain and was not changed after it was sent.
- DMARCDMARC is a rule you publish in your domain's DNS. It tells receiving servers what to do with an email that claims to be from your domain but fails SPF and DKIM. It also tells them where to send you reports.
- MX recordAn MX record is a setting on a domain that says which server receives email for that domain. When you send to name@example.com, your mail server looks up the MX record for example.com to find where to deliver the email.
- PTR recordA PTR record is a DNS record that connects an IP address to a server name. It is the reverse of a normal DNS record. Mail servers check the PTR record of the IP address that sends to them, and some reject email from an IP address with no PTR record.
- BIMIBIMI is an email standard that shows your brand logo next to your emails in inboxes that support it. It stands for Brand Indicators for Message Identification. It only works when your domain passes DMARC with a quarantine or reject policy.
