Record type reference
TXT Record
A TXT record holds free-form text at a DNS name. Email authentication, domain ownership checks and many security policies are published as TXT records at the apex or at special underscore names.
TXT record at a glance
| Field | Value |
|---|---|
| Type code | 16 |
| Defined in | RFC 1035, section 3.3.14 |
| Value | One or more quoted strings of up to 255 bytes each |
| Allowed at the apex | Yes, and many services expect it there |
| Can share a name with | Any 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
| Use | Name | Starts with |
|---|---|---|
| SPF (allowed senders) | example.com | v=spf1 |
| DKIM public key | selector._domainkey.example.com | v=DKIM1 |
| DMARC policy | _dmarc.example.com | v=DMARC1 |
| MTA-STS policy pointer | _mta-sts.example.com | v=STSv1 |
| TLS reporting | _smtp._tls.example.com | v=TLSRPTv1 |
| BIMI logo | default._bimi.example.com | v=BIMI1 |
| Ownership verification | Usually the apex | A 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)
| Command | What it does |
|---|---|
| dig example.com TXT | Every TXT record at the apex, with TTL |
| dig +short example.com TXT | Only the quoted strings |
| dig +short _dmarc.example.com TXT | The DMARC policy |
| dig +short selector1._domainkey.example.com TXT | A DKIM public key for one selector |
| dig +short _mta-sts.example.com TXT | The MTA-STS policy id |
nslookup (Windows, macOS, Linux)
| Command | What it does |
|---|---|
| nslookup -type=TXT example.com | Every TXT record at the apex |
| nslookup -type=TXT _dmarc.example.com | The DMARC policy |
| nslookup -type=TXT selector1._domainkey.example.com 1.1.1.1 | A DKIM key, asked of Cloudflare |
PowerShell (Windows)
| Command | What it does |
|---|---|
| Resolve-DnsName -Name example.com -Type TXT | TXT records; the text is in the Strings column |
| (Resolve-DnsName _dmarc.example.com -Type TXT).Strings | Just the DMARC text |
| Resolve-DnsName example.com -Type TXT | Where-Object { ($_.Strings -join '') -like 'v=spf1*' } | Only the SPF record, joined into one string |
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
- RFC 1035: Domain Names, Implementation and Specification: section 3.3.14 defines TXT
- RFC 7208: Sender Policy Framework (SPF): section 3 on publishing SPF in TXT
- RFC 6376: DomainKeys Identified Mail (DKIM) Signatures
- RFC 7489: Domain-based Message Authentication, Reporting, and Conformance (DMARC)
- BIND 9 manual: dig
- Microsoft Learn: nslookup
- Microsoft Learn: Resolve-DnsName