TXT record at a glance

FieldValue
Type code16
Defined inRFC 1035, section 3.3.14
ValueOne or more quoted strings of up to 255 bytes each
Allowed at the apexYes, and many services expect it there
Can share a name withAny type except CNAME

Here is how a TXT record looks in a zone file:

example.com.         3600 IN TXT "v=spf1 include:_spf.example.net -all"
example.com.         3600 IN TXT "site-verification=3f9a1c0e7b"
_dmarc.example.com.  3600 IN TXT "v=DMARC1; p=reject; rua=mailto:[email protected]"

Where TXT records live

UseNameStarts with
SPF (allowed senders)example.comv=spf1
DKIM public keyselector._domainkey.example.comv=DKIM1
DMARC policy_dmarc.example.comv=DMARC1
MTA-STS policy pointer_mta-sts.example.comv=STSv1
TLS reporting_smtp._tls.example.comv=TLSRPTv1
BIMI logodefault._bimi.example.comv=BIMI1
Ownership verificationUsually the apexA vendor prefix such as google-site-verification=

Underscore names keep each policy separate, so a DMARC record never collides with SPF. TXT records beyond SPF lists more of them.

Strings, length and size

Each string inside a TXT record can be at most 255 bytes. Longer values, such as a 2048-bit DKIM key, are split into several quoted strings in the same record, and SPF and DKIM verifiers join them back together without spaces. Most DNS provider dashboards do the split for you; in a zone file you write it yourself:

selector1._domainkey.example.com. 3600 IN TXT ( "v=DKIM1; k=rsa; p=MIIBIjANBgkqh..."
    "...remainder of the key..." )

Separate TXT records at the same name are not joined. That matters for SPF: a name must have exactly one record starting with v=spf1, and two of them is a permanent error. Dozens of verification tokens at the apex also make every TXT answer large, which can force resolvers to retry over TCP. Remove tokens for services you no longer use, but check each provider first: some, such as Google Search Console, recheck the token and revoke verification if it disappears.

How to look up a TXT record

Each tool below sends the query to your default resolver unless you name a server. Swap in your own domain for example.com, and add a public resolver such as 1.1.1.1 to compare answers with what your network sees.

dig (macOS, Linux, WSL)

CommandWhat it does
dig example.com TXTEvery TXT record at the apex, with TTL
dig +short example.com TXTOnly the quoted strings
dig +short _dmarc.example.com TXTThe DMARC policy
dig +short selector1._domainkey.example.com TXTA DKIM public key for one selector
dig +short _mta-sts.example.com TXTThe MTA-STS policy id

nslookup (Windows, macOS, Linux)

CommandWhat it does
nslookup -type=TXT example.comEvery TXT record at the apex
nslookup -type=TXT _dmarc.example.comThe DMARC policy
nslookup -type=TXT selector1._domainkey.example.com 1.1.1.1A DKIM key, asked of Cloudflare

PowerShell (Windows)

CommandWhat it does
Resolve-DnsName -Name example.com -Type TXTTXT records; the text is in the Strings column
(Resolve-DnsName _dmarc.example.com -Type TXT).StringsJust the DMARC text
Resolve-DnsName example.com -Type TXT | Where-Object { ($_.Strings -join '') -like 'v=spf1*' }Only the SPF record, joined into one string
Finding the DKIM selector

DKIM selectors are chosen by the sender, so there is no way to list them from DNS. Find the selector in the DKIM-Signature header (the s= tag) of a message from the domain, then query that name.

Common mistakes

  • Two SPF records at the same name. Merge them into one v=spf1 record.
  • Smart quotes pasted from a document. Curly quotes become part of the value and break parsing.
  • DMARC published at the apex. It must live at _dmarc.example.com.
  • A DKIM key cut short by a 255-byte string limit. Split the key into several strings in one record, not several records.
  • Tokens for retired services piling up. They leak which services you use and bloat every TXT response. Keep the ones a live service still checks.

TXT records in Domain Visualizer

Domain Visualizer looks up TXT at the apex and at the DMARC, MTA-STS, TLS-RPT, BIMI and common DKIM selector names on every scan. The detail panel recognizes SPF and DMARC records and breaks their tags out into a table.

FAQ

Is there a limit on TXT records per name?

The standard sets none, but the whole answer must fit in a DNS message. Very large TXT sets push answers past the usual UDP size and force a TCP retry, which some networks block.

Should I use the SPF record type instead of TXT?

No. The separate SPF type (99) was retired by RFC 7208. Publish SPF only as a TXT record.

Why do some TXT values appear split into several quoted parts?

Each string in a TXT record is limited to 255 bytes, so long values such as DKIM keys are stored as several strings. Tools that read them, such as DKIM verifiers, join the parts back together.

Sources and further reading