Knowledge base

TXT record

Learn what a DNS TXT record is, its versatile uses for email authentication (SPF, DKIM, DMARC), domain verification, common formats, lookup methods, and best practices to avoid common pitfalls.

What Is a TXT Record in DNS?

TL;DR
A TXT record stores arbitrary text strings associated with a domain name.
It's one of the most flexible DNS types and is widely used for:

  • Email authentication (SPF, DKIM, DMARC)
  • Domain ownership verification (Google, Microsoft, SSL providers)
  • Custom configuration or notes

TXT values are quoted strings (up to 255 chars each); multiple strings concatenate automatically.

Look up TXT records
Enter a domain name to lookup TXT records

Enter the domain name you want to lookup

How TXT Records Work

When queried, all TXT records for a name are returned.
Resolvers concatenate multiple strings into one value (no extra spaces added).
TXT is "unstructured" applications interpret the content (e.g., SPF parsers look for v=spf1).

Common Use Cases

  • Email authentication: SPF (authorized senders), DKIM (signatures), DMARC (policy & reporting)
  • Domain verification: proving ownership to Google Workspace, Microsoft 365, Let's Encrypt, AWS, etc.
  • Site verification: Google Search Console, Bing Webmaster Tools
  • Custom data: application configs, security policies, human-readable notes
  • Wildcard TXT: apply verification to all subdomains (rare)

How to Lookup TXT Records

dig example.com TXT
nslookup -type=TXT example.com

Record Format

NAME          TTL    CLASS  TYPE  VALUE
example.com.  3600   IN     TXT   "v=spf1 include:_spf.google.com ~all"
  • Values in quotes if they contain spaces
  • Multiple quoted strings allowed (concatenated)
  • No limit on number of TXT records per name

Valid Examples

Basic SPF

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

Long SPF (split strings)

example.com.  TXT  "v=spf1 include:_spf.google.com include:mailgun.org" "include:sendgrid.net ~all"

DMARC policy

example.com.  TXT  "v=DMARC1; p=quarantine; pct=100; rua=mailto:[email protected]"

Domain verification

example.com.  TXT  "google-site-verification=ABC123XYZ789abcdef"

DKIM public key (selector-based)

selector._domainkey.example.com.  TXT  "v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQD..."

TXT vs Other Record Types

FeatureTXTA / AAAAMX
PurposeArbitrary text / configIP address mappingMail server routing
Email auth supportYes (SPF/DKIM/DMARC)NoYes (delivery)
Multiple allowedYesYesYes
Root domainYesYesYes
Structured parsingApplication-specificNoPriority-based

→ See also: MX Record, A Record

Frequently Asked Questions

What's the max length of a TXT record?
255 chars per string, multiple strings concatenate (most providers allow ~4000+ total chars).
Why do email providers need TXT records?
SPF/DKIM/DMARC prevent spoofing and improve deliverability, without them, emails often land in spam.
Can I have multiple TXT records?
Yes, common for SPF + DMARC + DKIM + verifications.
How do I know which TXT records to add?
Follow your provider's instructions (Google, Microsoft, etc.), they give exact strings.

References

Related: MX Record · A Record · DNS Basics