Gaming industry under DDoS attack. Get DDoS protection now. Start onboarding
  1. Home
  2. Developers
  3. Understanding DNS TXT Records

Understanding DNS TXT Records

  • By Gcore
  • June 12, 2023
  • 2 min read
Understanding DNS TXT Records

Dive into the world of DNS TXT records with our beginner-friendly guide, exploring their diverse applications, from bolstering email security to verifying domain ownership.

What Is a TXT Record?

DNS TXT records, standing for text records, function as informational records that provide essential textual data to external sources. They are often used to store machine-readable data for a range of services. Let’s break down the essential elements of a TXT record:

  • Host: The specific domain or subdomain that the TXT record relates to.
  • TTL (Time To Live): This is the duration that the record’s cache is held by DNS resolvers, typically measured in seconds.
  • TXT Value:  This represents the actual textual or data content of the record, which often follows certain syntax rules based on its specific use.

For example, a typical TXT record might look like this:

example.com.   3600   IN   TXT   "Hello, World!"

In this example, the domain is “example.com”, the TTL is 3600 seconds (equivalent to one hour), and the TXT value is the phrase “Hello, World!”.

Applying DNS TXT Records

Despite their simplicity, TXT records are incredibly versatile and can be employed in various scenarios. Here are some of the most common:

1. SPF Records: The Sender Policy Framework (SPF) is an email authentication method aimed at preventing email spoofing. It functions by listing all servers authorized to send emails on behalf of your domain. A typical SPF TXT record could look something like this:

example.com.   3600   IN   TXT   "v=spf1 ip4:192.0.2.0/24 -all"

This record states that only servers within the IP range 192.0.2.0/24 are authorized to send an email for the domain “example.com”. All others should be rejected. More detailed information about SPF records can be found in the What Is an SPF Record: The Anti-Spam Tool in Email Security article.

2. DKIM Records: DomainKeys Identified Mail (DKIM) is another email security standard.  It enables the receiving server to check if an email, claimed to have come from a specific domain, was indeed authorized by the owner of that domain. A typical DKIM TXT record might look like this:

selector._domainkey.example.com.  3600  IN  TXT  "v=DKIM1; k=rsa; p=MIIBIjANB..."

The “p=” section usually contains a long string, which is the public part of a digital key pair. The corresponding private key is used by the sender to digitally sign email messages. More detailed information about DKIM records can be found in the What Is a DKIM Record? article.

3. DMARC Records: Domain-based Message Authentication, Reporting & Conformance (DMARC) is a protocol that uses SPF and DKIM to determine the authenticity of an email message. DMARC TXT records help protect your domain from spoofing and phishing attempts. An example might look like this:

_dmarc.example.com.  3600  IN  TXT  "v=DMARC1; p=reject; rua=mailto:[email protected]"

This record implies that any email not passing the SPF or DKIM check should be rejected, and reports about such incidents should be sent to [email protected].

4. Domain Verification: Services such as Google Workspace, Microsoft 365, and other online tools may ask you to add a TXT record to your DNS configuration. These are used to verify that you are the rightful owner of the domain and have control over its DNS records.

example.com.   3600   IN   TXT   "google-site-verification=abcdefg123456"

TXT records, though seemingly minor and simple, are a powerful instrument in your DNS toolkit.

Conclusion

Looking for reliable, high-performance DNS hosting? Choose Gcore DNS Hosting for fast and resilient DNS services:

  • Global latency averaging 30 ms
  • Anycast routing
  • Multiple load balancing options, including Geobalancing
  • Free-forever through enterprise-grade plans

Try for free

Related articles

What is DNS load balancing?

DNS load balancing is a technique that distributes incoming network traffic across multiple servers by manipulating DNS responses to improve the availability and performance of applications or services. It works at the application layer (la

What is GEO DNS?

GeoDNS is a DNS server technology that returns different IP addresses based on the geographic location of the client making the request. This enables geographic split-horizon DNS responses, directing users to servers closest to their physic

What is cloud networking: benefits, components, and implementation strategies

Cloud networking is the use and management of network resources, including hardware and software, hosted on public or private cloud infrastructures rather than on-premises equipment. Over 90% of enterprises are expected to adopt cloud netwo

3 use cases for geo-aware routing with Gcore DNS

If your audience is global but you’re serving everyone the same content from the same place, you're likely sacrificing performance and resilience. Gcore DNS (which includes a free-forever plan and enterprise-grade option) offers a straightf

Flexible DDoS mitigation with BGP Flowspec cover image

Flexible DDoS mitigation with BGP Flowspec

For customers who understand their own network traffic patterns, rigid DDoS protection can be more of a limitation than a safeguard. That’s why Gcore supports BGP Flowspec: a flexible, standards-based method for defining granular filters th

Tuning Gcore CDN rules for dynamic application data caching

Caching services like a CDN service can be a solid addition to your web stack. They lower response latency and improve user experience while also helping protect your origin servers through security features like access control lists (ACLs)

Subscribe to our newsletter

Get the latest industry trends, exclusive insights, and Gcore updates delivered straight to your inbox.