Gaming industry under DDoS attack. Get DDoS protection now. Start onboarding

Products

  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:admin@example.com"

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 admin@example.com.

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

CDN Caching: What It Is and How It Works

Every second of load time costs you. During a traffic spike, an uncached origin server can buckle under the pressure, and CDN caching can offload 70% to 90% of that traffic before it ever reaches your Gcore infrastructure. For a user in New

What Is an Edge Server?

Picture an autonomous vehicle doing 70 mph on the highway, waiting on a response from a data center hundreds of miles away. Or a surgeon depending on real-time imaging that freezes mid-procedure because data has to make a round trip across

What is Cache Hit Ratio and How Can You optimize It?

Every cache miss is a trip your server didn't need to make. And those trips add up fast. Sites with poorly optimized caching can see cache hit ratios as low as 70%, meaning three in 10 requests are hitting your origin server directly, dragg

What Is a High Availability Server?

Every minute your servers are down, your business is bleeding. For e-commerce sites, healthcare platforms, and revenue-critical applications, an outage isn't just an inconvenience. It's a direct hit to your bottom line, your reputation, and

Cloud vs Dedicated Server: Which Is Right for You?

Your server choice could be quietly costing you, or quietly holding you back. Pick the wrong infrastructure for your workload and you're either overpaying for idle hardware every month or watching your site buckle under traffic spikes you c

How to Troubleshoot DNS Issues: Complete Guide

Your website stops loading. Email bounces back. Users can't access your application. The culprit? A DNS failure that's invisible to most monitoring tools but devastating to your operations. When DNS breaks, every service that depends on it

Subscribe to our newsletter

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