TXT Record: What DNS Text Records Are, Uses, 255-Char Limit, and Examples
A DNS TXT (Text) record is a resource record that stores human-readable notes or machine-parsable text strings on a domain or subdomain. Automated services query TXT records to verify domain ownership and authenticate outbound email (SPF, DKIM, and DMARC). The string format of a TXT record supports multiple key-value policies.
What Is a DNS TXT Record and What Does Its Structure Look Like?
The DNS TXT record (IANA Type 16) has evolved into the primary machine-readable security and verification layer of the modern internet since its introduction in 1987 for attaching descriptive notes to hostnames. Cloud platforms and mail receivers query structured attribute=value TXT strings published at your root domain (@) or dedicated underscore subdomains (_dmarc, selector._domainkey, _mta-sts) to prove domain control and enforce email authentication. The table below defines the core technical specifications and wire constraints of a DNS TXT record.
The following BIND zone file illustrates production TXT records across root domains and subdomains, including their assigned TTL values:
; Host / Owner Name TTL Class Type Quoted Text Value (RDATA Payload)
example.com. 3600 IN TXT "v=spf1 include:_spf.google.com -all"
example.com. 3600 IN TXT "google-site-verification=rXOxyZounnZasA8Z7oaD3c14JdjS9aKSW"
_dmarc.example.com. 3600 IN TXT "v=DMARC1; p=reject; rua=mailto:dmarc@example.com;"
google._domainkey.example.com. 3600 IN TXT "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA..." | Specification Field | Wire / Protocol Value | Standard Reference | Technical Function in DNS Architecture |
|---|---|---|---|
| 1. IANA Record Type | Type 16 (0x0010) | RFC 1035 / RFC 1464 | Identifies the record as containing text or formatted character-string data. |
| 2. Storage Encoding | Binary Character-String | RFC 1035 Section 3.3.14 | Stores payload data as one or more discrete octet strings enclosed within quotes. |
| 3. String Chunk Limit | 255 Bytes (Octets) | RFC 1035 Section 2.3.4 | Restricts each character-string segment due to the 1-byte length prefix counter. |
| 4. Maximum Record Size | Up to 4,096 Bytes | RFC 6891 (EDNS0) | Permits multi-string payloads up to UDP buffer limits before TCP fallback. |
| 5. Namespace Scope | Apex (@) & Underscore | RFC 8552 / RFC 8553 | Isolates functional policies using underscore prefixes (_dmarc, _domainkey, _mta-sts). |
Mail receivers and verification crawlers identify each record's purpose by evaluating its domain host label and opening prefix. Apex queries return policies like SPF and ownership tokens, while underscore subdomains return dedicated cryptographic keys and transport rules. Discover live text records using the TXT Record Lookup.
7 Real-World Uses and Examples of DNS TXT Records (Reference Table)
Production domains deploy TXT records across 7 standardized security, email, and identity workflows, avoiding specialized DNS wire types for emerging protocols. The table below lists the 7 primary uses of DNS TXT records with host labels and value examples.
| Use Case / Protocol | Host / Name Label | Opening Prefix | Real-World TXT Value Example |
|---|---|---|---|
| 1. SPF (Sender Policy Framework) | @ (Apex Domain) | v=spf1 | v=spf1 ip4:198.51.100.10 include:_spf.google.com -all |
| 2. DKIM Public Key | selector._domainkey | v=DKIM1; | v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCg... |
| 3. DMARC Policy | _dmarc | v=DMARC1; | v=DMARC1; p=quarantine; pct=100; rua=mailto:dmarc@example.com; |
| 4. MTA-STS & TLS-RPT | _mta-sts / _smtp._tls | v=STSv1; / v=TLSRPTv1; | v=STSv1; id=2026103101; (and v=TLSRPTv1; rua=mailto:tls@example.com;) |
| 5. BIMI Brand Indicator | default._bimi | v=BIMI1; | v=BIMI1; l=https://example.com/logo.svg; a=https://example.com/vmc.pem; |
| 6. Domain Verification | @ (or Vendor Host) | Platform Token | google-site-verification=abc12345, MS=ms12345678, stripe-verification=xyz |
| 7. ACME DNS-01 SSL | _acme-challenge | Base64 Digest | LPsIwTo7o8BoG0-vjCyGQGBWSVIPxI-i_X336e2Q90E (Let's Encrypt validation) |
Deploying email authentication protocols requires syntax alignment across your zone. Analyze an SPF Record alongside our SPF Record Checker, examine cryptographic signing in DKIM Explained verified with the DKIM Record Checker, enforce inbox alignment through DMARC audited using the DMARC Record Checker, secure transport encryption with MTA-STS, and display verified inbox logos via BIMI.
Why Do TXT Records Have a 255-Character Limit (And How Does String Splitting Work)?
A single character-string inside a DNS TXT record is capped at 255 ASCII characters (bytes) because the DNS wire format precedes each text segment with a 1-byte unsigned length counter whose maximum binary value is 255 (11111111). Handling values exceeding 255 characters (such as 2048-bit DKIM public keys) requires adhering to 3 string-splitting rules:
- Split Long Payloads Into Multiple Quoted Segments Inside One TXT Record: A single TXT record accommodates multiple
<character-string>elements placed side by side inside double quotes ("chunk1" "chunk2"). This architecture enables total payloads up to the standard 4,096-byte EDNS0 buffer. - Resolvers Join Multi-String Segments With Zero Intervening Spaces: Recursive resolvers and mail servers concatenate adjacent quoted strings directly together during wire parsing without inserting whitespace. A 2048-bit DKIM key splits cleanly into two smaller segments as shown below:
; Splitting a 2048-bit DKIM key across two <=255-char strings: google._domainkey.example.com. 3600 IN TXT ( "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1234567890abcdef..." "...ghijklmnopqrstuvwxyz0987654321IDAQAB" ) - Include Trailing Whitespace When Splitting Space-Delimited SPF Mechanisms: Concatenating strings without intervening spaces requires placing an explicit space at the boundary when breaking long SPF records. Omitting this space causes two mechanisms to merge into an invalid token like
google.cominclude:sendgrid.net.
Cloud platforms like Cloudflare and Route 53 automatically split oversized text strings on the wire when administrators paste 400-character keys into web consoles. Conversely, BIND zone files, PowerDNS, and cPanel require manual quoting partitions, detailed in our diagnostic guide on SPF Record Too Long.
How Many TXT Records Can a Domain Have? (Coexistence Rules and Zone Hygiene)
While the DNS protocol sets no hard count limit on how many TXT records a domain publishes, administrators follow 4 critical coexistence, packet-size, and security rules:
- Multiple Verification Tokens Coexist Safely on the Apex Domain, Except SPF: Administrators publish separate TXT records on the root domain (
@) for Google Search Console, Microsoft 365, Apple, and Stripe simultaneously. However, DNS rules prohibit publishing multiplev=spf1records on one hostname, which triggers immediate SPF PermError delivery failures. - A TXT Record Cannot Coexist With a CNAME Record on the Same Subdomain: Publishing a CNAME Record on an alias like
app.example.comprevents adding any TXT records to that exact hostname. Verification tokens for external platforms reside on the root domain or separate subdomains. - Keep Root Domain TXT Records Under 30 to 49 Entries to Prevent UDP Truncation: Resolvers query TXT records as an atomic RRset, returning every root record in a single packet. Exceeding 49 TXT records or 4,096 total bytes forces nameservers to set the Truncated (TC=1) bit, requiring fallback retries over TCP port 53.
- Remove Deprecated Third-Party Verification Strings Regularly: Orphaned verification tokens left behind by former marketing agencies, retired analytics tools, or obsolete SaaS providers needlessly expand UDP packets and create security risks by permitting former account holders to re-claim administrative control.
Performing routine quarterly zone audits ensures your root domain remains clean, preventing response payload bloating while preserving essential mail authentication records and active platform verifications.
4 Formatting Rules for Adding TXT Records in DNS Control Panels (Quotes and Spaces)
Preventing syntax parsing errors when entering TXT values into DNS dashboards requires following 4 strict formatting rules regarding quotation marks, whitespace, and host namespacing:
- Omit Outer Quotation Marks in Web Dashboards (Except BIND and Route 53): Web-based DNS consoles wrap text values in double quotes automatically during zone generation. Entering explicit quotes in dashboards like GoDaddy or Namecheap produces escaped literal quotation marks (
\"v=spf1...\") that break downstream parsers. - Never Paste Smart or Typographic Quotes From Word Processors: Text copied from word processors, chat applications, or formatted documents often contains curly quotes (
“ ”) instead of standard ASCII straight quotes ("), invalidating the DNS record. - Preserve Single Spaces in SPF and DMARC While Removing Internal Spaces From DKIM Keys: Space characters separate distinct SPF mechanisms (
v=spf1 include:... -all) and DMARC tags (v=DMARC1; p=reject;). Conversely, public DKIM Base64 keys (p=MIIBIjAN...) contain zero internal spaces or line breaks to pass cryptographic verification. - Exclude the Root Domain From Prefixed Host Input Fields: Modern DNS management interfaces append your root domain to the Host/Name box automatically. Entering
_dmarc.example.cominstead of typing_dmarccreates an unintended nested record at_dmarc.example.com.example.com.
Understanding how text records function alongside address, mail routing, and delegation records provides comprehensive visibility into zone administration, detailed across our guide to DNS Record Types.
How to Check and Verify Your Domain's TXT Records (dig, nslookup, and Browser DoH)
Inspecting live TXT values published across your root domain or targeted underscore subdomains confirms that external systems receive accurate policies across 3 diagnostic terminal queries:
# 1. Query all root (@) TXT records (SPF and site verifications) on Linux / macOS:
dig example.com TXT +short
# 2. Query targeted underscore subdomains for DMARC and DKIM selectors:
dig _dmarc.example.com TXT +short
dig google._domainkey.example.com TXT +short
# 3. Query TXT records on Windows Command Prompt:
nslookup -type=txt example.com 1.1.1.1 Terminal diagnostics provide immediate confirmation of local resolver responses, while validating nameserver synchronization across global geographic regions requires monitoring through our DNS Propagation Checker. Managing DNS Text resource record (Type 16) configurations properly safeguards SPF, DKIM, and DMARC authentication, preserves third-party domain ownership verification tokens, and respects the 255-character string limit through clean multi-string splitting.
Frequently asked questions
Why don't my DMARC or DKIM records show up when I run a TXT lookup on my domain?+
Running a TXT lookup on your bare root domain (example.com) only returns TXT records published at @ (such as your SPF record and Google site verification). DMARC and DKIM policies live on specific subdomains, requiring queries targeted directly at _dmarc.example.com or selector._domainkey.example.com.
Does adding a verification TXT record affect my website or email?+
No, adding a third-party ownership verification TXT record (such as google-site-verification= or MS=) produces zero effect on website traffic or email delivery, provided administrators add the value as a separate new TXT entry rather than modifying existing v=spf1 records.
Is it safe to delete Google Search Console or Microsoft verification TXT records after my domain is verified?+
No, in practice you retain verification TXT records in your DNS zone for the entire lifecycle of the connected service. Google Search Console, Microsoft 365, and Google Workspace periodically re-check your DNS in the background and revoke administrative domain ownership if the verification token disappears.
What happens if my TXT record is longer than 255 characters?+
In real-world DNS setups, a single continuous character-string cannot exceed 255 ASCII characters on the wire due to the 1-byte length prefix. Modern cloud DNS providers automatically split oversized values (such as 2048-bit DKIM keys) into multiple 255-character quoted strings, which validating resolvers concatenate without spaces.
Last verified: 2026-10-31