A TXT record (Text record) is a type of DNS resource record that allows a domain owner to store arbitrary, machine-readable text information for use by external services. Unlike A, AAAA, or MX records, it does not route network traffic to an IP address or mail server. Instead, it acts as a public metadata layer that any DNS client or third-party platform can query to verify configuration settings and security policies.
How it works
Each TXT record consists of a hostname (such as the root domain @ or a specific subdomain), a Time to Live (TTL) value, and one or more text strings typically enclosed in double quotes. Under the DNS protocol, a single character string is limited to 255 characters, though multiple strings can be concatenated within the same record to store longer values like cryptographic keys.
When an external service needs to validate a domain, it performs a standard DNS lookup for the TXT record type on the designated hostname. Common operational uses include:
- Domain ownership verification: Platforms like Google Workspace, Microsoft 365, and SSL certificate authorities provide a unique token that you publish as a TXT record to prove administrative control over the domain.
- Email authentication: Security frameworks rely on TXT records to prevent spoofing and phishing, including SPF (Sender Policy Framework), DKIM (DomainKeys Identified Mail), and DMARC (Domain-based Message Authentication, Reporting, and Conformance).
- Service discovery and encryption: Applications use structured text strings to publish configuration parameters or opportunistic encryption keys.
Example
In a standard BIND-style DNS zone file, an SPF policy and a domain verification token appear as follows:
@ 3600 IN TXT "v=spf1 ip4:192.0.2.10 include:_spf.mailprovider.example -all"
@ 3600 IN TXT "verification-token=9f86d081884c7d659a2feaa0c55ad015"
You can inspect live TXT records from a terminal using the dig utility:
dig +short TXT example.com
When a receiving mail server processes an incoming message, it runs a similar query against the sender's domain. If the originating server's IP address does not match 192.0.2.10 or the included mail provider's range, the -all directive instructs the recipient to reject or flag the message.
What matters when choosing a server or hosting
Because modern web applications frequently rely on third-party email providers, CDNs, and analytics tools, your DNS provider's handling of TXT records directly affects reliability:
- Multi-string splitting support: Long 2048-bit DKIM keys exceed the 255-character string limit. A capable DNS control panel automatically splits long entries into valid quoted segments rather than rejecting the input.
- Packet size and DNSSEC: Keeping total TXT responses under 512 bytes prevents traditional UDP packet fragmentation, though modern resolvers using EDNS0 handle larger payloads.
- API automation: If you use Let's Encrypt wildcard certificates via DNS-01 challenges, your hosting or DNS provider must offer an API so tools like Certbot can create and remove verification records automatically.
Common mistakes
- Publishing multiple SPF records: A domain must have only one TXT record starting with
v=spf1. Adding a second separate SPF record invalidates both and causes email delivery failures; new senders must be merged into the existing string. - Incorrect subdomain placement: Services like DMARC and DKIM require records on specific subdomains (such as
_dmarc.example.com). Placing them on the root domain renders them invisible to mail filters. - Duplicate domain suffixes: Many web-based DNS editors automatically append your domain name to the host field. Entering
_dmarc.example.cominstead of_dmarcoften creates_dmarc.example.com.example.com.
FAQ
Can a domain have multiple TXT records on the same hostname?
Yes. A single hostname can hold several TXT records simultaneously for different purposes, such as an SPF policy alongside multiple site verification tokens. However, specific protocols like SPF and DMARC strictly allow only one record of their own type per hostname.
How long do TXT record changes take to apply?
Updates propagate based on the record's TTL value and the caching behavior of recursive DNS resolvers. Newly added records usually appear within minutes, while edits to existing records may take up to the previous TTL duration to refresh globally.
Do TXT records affect website loading speed?
No. Web browsers only query A, AAAA, or CNAME records when loading a webpage. TXT records are ignored during standard HTTP requests and are only fetched by specialized services performing verification or mail checks.