Home/Glossary/TXT record

TXT record

A type of DNS resource record that allows a domain owner to store arbitrary text information for use by external services.

A TXT record is a DNS resource record used to associate arbitrary text with a host or other name. Unlike A or MX records, it does not route traffic to a specific IP address but provides machine-readable data to external services. This mechanism allows domain owners to publish metadata that can be retrieved by any DNS client.

Each record consists of a hostname, a text string (usually enclosed in quotes), and a TTL value. While the DNS protocol supports strings up to 255 characters per segment, multiple segments can be concatenated to form a single record. To ensure compatibility and avoid UDP packet fragmentation, administrators typically keep the total size of TXT records under 512 bytes.

Common use cases include:

  • Domain ownership verification for services like Google Workspace, Microsoft 365, or SSL providers.
  • Email security frameworks such as SPF, DKIM, and DMARC.
  • Storing site-specific configuration data and opportunistic encryption keys.

How it works

An SPF record example: v=spf1 ip4:192.168.0.1 include:_spf.example.com -all. When a mail server receives an email, it queries the DNS for the sender's TXT records. If the sender's IP is not listed in the SPF record, the email is flagged as suspicious. This simple text-based check is a primary defense against domain spoofing and phishing attacks.