TXT Record

How to Create a TXT Record and Add It to DNS

In today’s digital world, websites and email domains rely on the Domain Name System (DNS) to connect infrastructure, prove ownership, and secure communications. One of the most versatile tools in the DNS toolbox is the TXT record — a simple yet powerful type of DNS entry that carries text information used for domain verification, email authentication, and security policies.

In this guide, you’ll learn what a TXT record is, why it matters for email and web security, and step-by-step instructions to create and publish one in DNS. By the time you’re done, you’ll have a firm understanding of TXT records and how to use them to strengthen your domain’s online presence.

What Is a DNS TXT Record?

A TXT record is a type of DNS record that allows domain administrators to store text information in the DNS. Unlike other DNS records — such as A records (which map domain names to IP addresses) — TXT records can hold readable text that may be interpreted by humans, machines, or both.

Originally, TXT records were intended for free-form notes. Over time, they have become essential for domain ownership verification and email authentication, especially when configuring protocols like SPF, DKIM, and DMARC.

Because DNS was not designed to store massive amounts of text, TXT records typically have size limits. Most DNS services enforce a 255-character maximum per string, though larger values can be split into multiple quoted strings that DNS will join together.

Why TXT Records Matter

1. Verify Domain Ownership

Many online services — from Google Workspace and Office 365 to web-monitoring tools — ask you to prove you control your domain. A common way to do this is by asking you to add a specific TXT record to DNS. When the service checks DNS and sees that text, it confirms you own the domain.

Email Security

2. Power Email Security Protocols

TXT records are the foundation of major email authentication standards:

  • SPF (Sender Policy Framework) lists which email servers are permitted to send mail on behalf of your domain.
  • DKIM (DomainKeys Identified Mail) public keys live in TXT records to help email systems verify signatures on outgoing messages.
  • DMARC (Domain-based Message Authentication, Reporting & Conformance) tells receiving mail servers what to do when incoming emails fail SPF or DKIM checks.

These protocols dramatically reduce spoofing, phishing, and spam abuse. Without correct TXT records, legitimate email from your domain may be flagged as suspicious or fail to deliver entirely.

Understanding TXT Record Structure

A typical TXT record consists of three fields:

  • Host/Name: The part of your domain the TXT record applies to (e.g., _dmarc, @, or a subdomain).
  • Type: Always “TXT” for this record type.
  • Value: The text content itself — whether a verification code or a protocol policy.
  • TTL (Time to Live): How long DNS resolvers cache the record before refreshing it.

For example:

Host/Name: @  

Type: TXT  

Value: “This is a human-readable note.”  

TTL: 3600

When used for email authentication, the value field must follow a precise syntax that the receiving email servers can interpret correctly. For instance, a simple DMARC record might look like:

“v=DMARC1; p=none; rua=mailto:reports@yourdomain.com”

In this example:

  • v=DMARC1 declares the protocol version.
  • p=none tells receivers not to reject emails that fail checks, but to report them.
  • rua=mailto: designates where aggregate DMARC reports should be sent.
 reject emails

How to Create a TXT Record (General Steps)

Before you dive into any DNS dashboard, it’s useful to understand the core pieces you’ll interact with:

  1. Log in to your DNS provider’s control panel.
  2. Navigate to the section where DNS records are managed (often called DNS Management, DNS Zone Editor, or Advanced DNS).
  3. Choose to create a new record and select TXT as the record type.
  4. Fill in the Host/Name, Value, and TTL fields as required by your use case.
  5. Save or publish the record and wait for DNS propagation.

Let’s expand on that with clear, actionable instructions:

Step-by-Step: Adding a TXT Record to DNS

Step 1: Identify Your DNS Hosting Provider

If you’re unsure where your DNS is managed, use a WHOIS lookup to find your domain’s nameservers. These typically point to the company that hosts your DNS. Once identified, log into their control panel.

Step 2: Find Your DNS Zone Editor

Once logged in, look for the DNS settings or advanced controls section. This is where all your domain’s resource records are listed — A, MX, CNAME, and TXT among them.

Step 3: Create the TXT Record

  • Click on “Add Record” or a similar button.
  • Choose TXT from the list of record types.
  • Decide what you want to put in the Host/Name field. For email authentication, this could be:
    • _dmarc for a DMARC policy
    • @ to place the record at the root domain
    • A service-specific host name for verification
  • Enter the Value — whether that’s a text note, a verification token, or a formatted email policy like SPF or DMARC.
  • Set a reasonable TTL (common values are 3600 to 86400).

Step 4: Save and Publish

After creating the record, save your changes. It may take anywhere from a few minutes up to 72 hours for the record to propagate worldwide, depending on DNS caching and TTL values.

DNS caching

How to Check Your TXT Record

Once published, it’s important to confirm your TXT record is live and correctly formatted. You can check this using:

  • Online DNS lookup tools — enter your domain and choose TXT lookup to see returned records.
  • Local CLI tools such as:
    • dig yourdomain.com TXT +short (Mac/Linux)
    • nslookup -type=TXT yourdomain.com (Windows)

These tests help verify that the DNS propagation is complete and the expected TXT records are accessible.

Common TXT Record Use Cases

Let’s look at real scenarios where TXT records make a difference:

1. Domain Verification for Third-Party Services

When setting up services like Google Analytics, Microsoft 365, or marketing platforms, providers often ask you to add a unique TXT record to your DNS to confirm you own the domain.

2. Email Authentication (SPF, DKIM & DMARC)

TXT records are the backbone of modern email security. Without correctly configured SPF and DKIM, DMARC won’t function effectively, leaving your domain vulnerable to abuse.

3. Custom Metadata or Debugging

Some organizations use TXT records to store non-critical metadata for troubleshooting, internal documentation, or service coordination.

verification checks

Best Practices for TXT Records

Here are some practical tips:

  • Keep TXT values accurate and current. A small typo can break email authentication or verification checks.
  • Watch for size limits. If your text is longer than the DNS provider’s limit, split it into multiple quoted strings.
  • Use clear naming conventions. When creating multiple TXT records, choose intuitive hosts so you know what each entry is for.
  • Monitor propagation. Use DNS lookup tools regularly after changes to ensure global visibility.

Conclusion

TXT records may seem simple on the surface, but they play a critical role in domain security, email deliverability, and verification workflows. Whether you’re publishing an SPF policy, deploying a DMARC record, or verifying domain ownership for a third-party service, many paths start with adding a correctly formatted TXT record to DNS.

At DMARCReport, we believe that understanding how DNS works — especially TXT records — gives you a strategic advantage in managing your online presence and protecting your reputation.

If you want help generating DNS records or verifying your setup, our tools and guides are designed to make it easy to get it right the first time.

Similar Posts