Skip to content
hostcomplex

TXT Record

Maarten Soetens 3 min read

What a TXT Record Holds

A TXT record is a DNS record that attaches free-form text to a name. Unlike an A or MX record, it does not point to an address or a server. It holds text that other systems can read, which makes it a flexible place to publish information about a domain.

Because the text is public, anyone can query a TXT record with a standard DNS tool. Treat its contents as information you are willing to publish. A TXT record can sit on the bare domain or on a specific name, such as _service.example.com, which keeps unrelated entries apart. For the full list of record types, see DNS record types.

Common Uses for TXT Records

Most TXT records fall into a few categories:

  • Domain ownership checks. A service asks you to add a random string to your DNS. It then looks up the TXT record to confirm that you control the domain.
  • Certificate validation. Some certificate authorities check a TXT record with a specific name to confirm domain control before issuing a certificate. A related control is CAA records, which restrict which authorities may issue.
  • Email authentication. Policies such as SPF, DKIM and DMARC are published as TXT records alongside your MX records. Their syntax and purpose are covered in the email category.

The verification use is the most common reason people add a TXT record. Some services check the record only once, while others check it again from time to time, so removing it too early can break a feature.

Format Limits and Safety Notes

A TXT record contains one or more character strings. Each string can be up to 255 characters long. A longer value is split into several strings inside the same record, and a name can carry several TXT records at once. A typical entry looks like this:

example.com. 3600 IN TXT "verification=abc123"

Two practical points follow. First, a name that carries one kind of policy, such as an email sender policy, should have only one such record, because a second copy can make the checking system reject the policy. Second, TXT records are cached like other DNS data, so a newly added value may take time to appear everywhere.

Frequently asked questions

Can I Store a Password or API Key in a TXT Record?

No. TXT records are public, and anyone can query them with a standard DNS tool. Passwords, API keys and other secrets belong in a secrets manager or other protected storage. A TXT record is suitable only for values that are meant to be read by others, such as a verification token.

How Long Can a TXT Record Value Be?

Each string inside a TXT record can be up to 255 characters. Longer values are split into several strings within the same record, which DNS clients join back together when they read it. Very large answers can be truncated on some networks, so keep values short where you can.

  • Two-Factor Authentication

    Two factor authentication hosting adds a second check to control panel, domain and CMS logins. Learn which methods are strongest and why 2FA helps.

  • What Is an A Record?

    What is an A record? Learn how this DNS record maps a hostname to an IPv4 address, why domains use several A records and the root and www pattern.

  • Billing and Automation Platforms

    What is WHMCS? Learn how this commercial billing and automation platform helps hosts sell plans, collect payments and create accounts automatically.