Email Security

What are DNS TXT records used for?

DNS TXT records store text data for various purposes including email authentication, domain ownership verification, and service configuration. Learn all the uses of TXT records.

By Inventive HQ Team

Understanding DNS TXT Records

A DNS TXT record stores free-form text at a domain name so that other systems can read a machine-readable policy or proof of ownership — and in practice that text does four jobs: it authenticates email (SPF, DKIM, DMARC), it proves you control a domain to services like Google or Microsoft 365, it advertises brand and reporting policies (BIMI, TLSRPT), and it configures service discovery. Despite the generic name, the meaning of any TXT record comes entirely from a prefix the reader looks for — v=spf1, v=DMARC1, google-site-verification= — and the same domain can hold many unrelated TXT records at once.

That is the summary an AI Overview would give you. What it can't show you is where each record actually lives (the root domain vs. the _dmarc and _domainkey subdomains is where most people go wrong), how the pieces map to a real resolver query, and how to read the raw strings back for a specific domain. The anatomy diagram, the at-a-glance comparison table, and the live lookup below cover exactly that.

Where each type of TXT record lives under a domain example.com holds SPF and verification TXT records at the root, while DMARC lives at the _dmarc subdomain, DKIM at selector._domainkey, and BIMI at default._bimi. One domain, many TXT records — the location is the trick Each authentication type is read from a different name under example.com example.com SPF — at the root example.com "v=spf1 include: _spf.google.com ~all" Verification — root example.com "google-site- verification=abcd..." DMARC — subdomain _dmarc.example.com "v=DMARC1; p=reject; rua=..." DKIM — selector subdomain selector._domainkey.example.com "v=DKIM1; k=rsa; p=MIGfMA0GCSq..." BIMI — brand logo default._bimi.example.com "v=BIMI1; l=https://.../logo.svg"

TXT record types at a glance

RecordPublished atPrefix to look forWhat it doesReach for it when
SPFroot (example.com)v=spf1Lists which servers may send mail for the domainYou send email from any domain — this is the baseline
DKIMselector._domainkeyv=DKIM1Publishes the public key that verifies signed mailYour mail provider gives you a selector + key to add
DMARC_dmarc subdomainv=DMARC1Tells receivers what to do when SPF/DKIM fail, and where to reportYou have SPF and DKIM working and want to stop spoofing
Verificationusually rootgoogle-site-verification=, MS=Proves you control the domain to a third partyA service (Search Console, M365, Stripe) asks you to verify
BIMIdefault._bimiv=BIMI1Points to your brand logo for supporting inboxesDMARC is at p=quarantine/p=reject and you want your logo shown
TLSRPT_smtp._tls / _tlsrptv=TLSRPTv1Requests reports about failed TLS for inbound mailYou run MTA-STS and want visibility into TLS failures

If you only do one thing from this table: publish SPF at the root, DKIM at the selector subdomain, and DMARC at _dmarc. That trio is what mailbox providers now require from bulk senders.

Check a domain's TXT records right now

Enter any domain to pull its live TXT records — root, _dmarc, and DKIM selectors — straight from authoritative DNS servers, without opening a terminal:

Loading interactive tool...

Primary Uses of TXT Records

1. SPF Records (Sender Policy Framework)

Purpose: Specifies which mail servers can send email for your domain

Format:

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

Components:

  • v=spf1: SPF version
  • include:: Include another domain's SPF record
  • ip4:: Specific IPv4 address allowed
  • ip6:: Specific IPv6 address allowed
  • ~all: Soft fail (accept if SPF fails)
  • -all: Hard fail (reject if SPF fails)

Examples:

# Google Workspace
v=spf1 include:_spf.google.com ~all

# Office 365
v=spf1 include:outlook.com ~all

# SendGrid
v=spf1 include:sendgrid.net ~all

# Multiple services
v=spf1 include:_spf.google.com include:sendgrid.net include:example.com ~all

Importance:

  • Prevents domain spoofing
  • Improves email deliverability
  • Required for DMARC compliance
  • Part of email authentication trio (SPF, DKIM, DMARC)
Advertisement

2. DKIM Records (DomainKeys Identified Mail)

Purpose: Cryptographic signature for email authentication

Format:

selector._domainkey.example.com    TXT    "v=DKIM1; k=rsa; p=[PUBLIC_KEY]"

Components:

  • v=DKIM1: DKIM version
  • k=rsa: Key type (RSA)
  • p=: Public key (very long)

Full Example:

selector1._domainkey.example.com    TXT    "v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC..."

Importance:

  • Proves message came from your domain
  • Prevents message tampering
  • Required for DMARC compliance
  • Widely supported by email providers

3. DMARC Records (Domain-based Message Authentication, Reporting, and Conformance)

Purpose: Email authentication policy and reporting

Format:

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

Components:

  • v=DMARC1: DMARC version
  • p=none/quarantine/reject: Policy
  • rua=: Aggregate report destination
  • ruf=: Forensic report destination
  • fo=: Forensic report options
  • pct=: Percentage of messages subject to policy
  • adkim=: DKIM alignment (strict/relaxed)
  • aspf=: SPF alignment (strict/relaxed)

Full Example:

_dmarc.example.com    TXT    "v=DMARC1; p=reject; rua=mailto:dmarc@example.com; ruf=mailto:dmarc-forensic@example.com; fo=1; adkim=s; aspf=s"

Importance:

  • Prevents business email compromise
  • Protects brand from spoofing
  • Provides insight into mail authentication
  • Enables subdomain protection

Domain Verification Uses

4. Domain Ownership Verification

Many services require proving domain ownership:

Google Search Console:

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

Microsoft/Office 365:

example.com    TXT    "MS=ms12345678"

Acme/Let's Encrypt SSL:

_acme-challenge.example.com    TXT    "verification-token"

Facebook:

example.com    TXT    "facebook-domain-verification=..."

Stripe:

example.com    TXT    "stripe-verification=..."

Process:

  1. Service provides verification string
  2. You add as TXT record
  3. Service verifies TXT record exists
  4. Ownership confirmed

5. Email Provider Verification

Services need to verify domain ownership:

Mailchimp:

example.com    TXT    "mailchimp-verification=..."

HubSpot:

example.com    TXT    "hubspot-verification=..."

SendGrid:

example.com    TXT    "sendgrid-domain-verification=..."

Advanced Authentication Records

6. BIMI Records (Brand Indicator for Message Identification)

Purpose: Display company logo in email clients

Format:

default._bimi.example.com    TXT    "v=BIMI1; l=https://example.com/logo.svg"

Requirements:

  • DMARC policy set to p=reject
  • Valid SVG logo
  • Logo must be under 32KB
  • HTTPS-hosted logo

Benefit: Brand protection and recognition in email

7. DANE Records (DNS-based Authentication of Named Entities)

Purpose: Enhanced TLS certificate verification

Format:

_25._tcp.example.com    TLSA    3 1 1 [certificate_hash]
_443._tcp.example.com   TLSA    3 1 1 [certificate_hash]

Benefits:

  • Certificate pinning via DNS
  • Protection against rogue CAs
  • Enhanced security for email and HTTPS

Service Configuration Records

8. Service Discovery

Purpose: Locate specific services

Format:

_service._protocol.example.com    TXT    "key1=value1 key2=value2"

Examples:

Autodiscover (Exchange):

_autodiscover._tcp.example.com    TXT    "product=Exchange"

SIP (VoIP):

_sip._tls.example.com    TXT    "version=1"

CalDAV/CardDAV:

example.com    TXT    ".well-known/carddavserver"

Security and Policy Records

9. CAA Policy (Certificate Authority Authorization)

While CAA is technically a different record type, often stored alongside TXT:

example.com    CAA    0 issue "letsencrypt.org"
example.com    CAA    0 issuewild "letsencrypt.org"

Purpose: Control who can issue SSL certificates

10. TLSRPT Records (TLS Report)

Purpose: Report TLS failures for email

Format:

_tlsrpt.example.com    TXT    "v=TLSRPTv1; rua=mailto:tlsrpt@example.com"

DNS TXT Record Best Practices

Managing Multiple TXT Records

Single Record (Preferred):

example.com    TXT    "v=spf1 include:_spf.google.com ~all"
example.com    TXT    "v=DMARC1; p=reject; rua=mailto:admin@example.com"

Multiple records with same name are allowed and common.

Record Length Limits

TXT records are limited to 255 characters per string, but multiple strings possible:

example.com    TXT    "v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3..." "...CONTINUED..."

DNS tools automatically split long records.

Organization Tips

  1. Document all TXT records and their purposes
  2. Maintain version control of TXT record changes
  3. Test before deployment (especially email records)
  4. Monitor for changes by others
  5. Keep records organized with comments in DNS provider

Viewing TXT Records

Command Line

# View TXT records
dig example.com TXT

# View specific subdomain
dig _dmarc.example.com TXT

# View all records
dig example.com ANY

# Pretty print
dig example.com TXT +short

Online Tools

  • Inventive HQ DNS Lookup Tool
  • MXToolbox TXT Record Checker
  • Google Public DNS (dns.google)
  • Online DNS query tools

Common TXT Record Issues

Issue 1: Character Limit Exceeded

Problem: SPF record with too many includes:

v=spf1 include:service1.com include:service2.com include:service3.com include:service4.com include:service5.com include:service6.com include:service7.com include:service8.com include:service9.com include:service10.com ~all
# Exceeds DNS limit!

Solution: Use SPF flattening or consolidation

# Create intermediate SPF record
_spf.example.com        TXT    "v=spf1 include:service1.com include:service2.com ~all"
example.com            TXT    "v=spf1 include:_spf.example.com ~all"

Issue 2: DKIM Key Too Long

Problem: Very long DKIM public key won't fit in one TXT record

Solution: DNS provider handles splitting automatically, but verify it's stored correctly

dig selector._domainkey.example.com TXT
# Should show complete key

Issue 3: Conflicting Records

Problem: Multiple verification records from different services

Solution: Multiple TXT records allowed; add all needed records

example.com    TXT    "v=spf1 ..."
example.com    TXT    "v=DMARC1; ..."
example.com    TXT    "google-site-verification=..."
example.com    TXT    "microsoft-domain-verification=..."
# All can coexist

Complete TXT Record Setup Example

Comprehensive email security setup:

# SPF (email authentication)
example.com    TXT    "v=spf1 include:_spf.google.com include:sendgrid.net ~all"

# DKIM (message signing)
selector1._domainkey.example.com    TXT    "v=DKIM1; k=rsa; p=[PUBLIC_KEY]"

# DMARC (policy enforcement)
_dmarc.example.com    TXT    "v=DMARC1; p=reject; rua=mailto:dmarc@example.com; ruf=mailto:dmarc-forensic@example.com; fo=1"

# Domain verification (Google)
example.com    TXT    "google-site-verification=abcd1234"

# BIMI (logo display)
default._bimi.example.com    TXT    "v=BIMI1; l=https://example.com/logo.svg"

Conclusion

DNS TXT records serve diverse purposes from email authentication to domain verification. Understanding these uses enables you to:

  • Implement robust email security (SPF, DKIM, DMARC)
  • Verify domain ownership for multiple services
  • Configure service discovery
  • Implement advanced security features (BIMI, DANE)
  • Troubleshoot email and service issues

Proper TXT record configuration is foundational to modern email security and domain management. Whether you're implementing email authentication or verifying domain ownership, TXT records are the tool for the job.

Frequently Asked Questions

What is a DNS TXT record used for?

A DNS TXT record stores arbitrary text at a domain name so other systems can read machine-readable policy or proof. The four most common uses are email authentication (SPF, DKIM, and DMARC), domain ownership verification for services like Google Search Console and Microsoft 365, brand/logo signalling (BIMI), and reporting policies (TLSRPT). The record is just text — its meaning comes from a prefix like "v=spf1" or "v=DMARC1" that the reading system looks for.

What is the character limit on a TXT record?

Each individual character-string inside a TXT record is capped at 255 octets by RFC 1035. A single TXT record can hold multiple concatenated strings, so the practical ceiling is much higher (a UDP DNS response is limited to 512 bytes without EDNS0, but EDNS0 and TCP fallback allow larger responses). This is why long DKIM public keys are split into several quoted "chunks" that resolvers stitch back together.

Can I have more than one TXT record on the same domain?

Yes. Multiple TXT records at the same name are allowed and normal — you might have an SPF record, a Google verification string, and a Microsoft 365 verification string all on the root domain at once. The one exception is SPF: a domain must publish only ONE record that begins with "v=spf1". Two SPF records on the same name is a permanent error and breaks authentication.

Where does the DMARC TXT record go?

DMARC is published as a TXT record at the special subdomain "_dmarc" — for example "_dmarc.example.com", not the root domain. DKIM lives at "selector._domainkey.example.com", and SPF lives at the root domain itself. Putting a DMARC policy on the root domain instead of "_dmarc" is a common mistake that leaves the domain with no DMARC protection at all.

What is the difference between ~all and -all in an SPF record?

Both are the "all" mechanism that catches senders not listed earlier in the record. "~all" is a softfail — receiving servers should accept the mail but mark it as suspicious. "-all" is a hardfail — receiving servers should reject unlisted senders outright. Start with "~all" while testing, then move to "-all" once you are confident every legitimate sending source is included.

How do I view the TXT records for a domain?

From a terminal, run "dig example.com TXT +short" for the root, "dig _dmarc.example.com TXT +short" for DMARC, and "dig selector._domainkey.example.com TXT +short" for a DKIM key. On Windows you can use "nslookup -type=TXT example.com". Online, a DNS lookup tool queries authoritative servers and formats the strings for you — useful when you want to confirm a change has propagated.

Do TXT records affect email deliverability?

Indirectly but significantly. SPF, DKIM, and DMARC are all published as TXT (or the DMARC/DKIM subdomains) records, and mailbox providers like Gmail and Yahoo now require them for bulk senders. A missing or misconfigured TXT record can cause legitimate mail to land in spam or be rejected, while correct records improve inbox placement and let you protect the domain from spoofing.

How long does a TXT record take to take effect?

A new or changed TXT record is live once it propagates, which is governed by the record's TTL (time to live). If the old record was cached with a 3600-second TTL, resolvers may serve the stale value for up to an hour. Adding a brand-new record with no prior cache is usually visible within a few minutes. Lower the TTL before a planned change so updates propagate faster.

DNS TXT recordsSPFDKIMDMARCdomain verification