What is a TXT record and how do you create one?
Published on June 18, 2026 9 min read
What is a TXT record and what do you use it for? Learn how a TXT record is structured, how to create one yourself, and how to check it in DNS.
A TXT record is a type of DNS record that lets you attach small pieces of text to your domain. You use a TXT record to prove that a domain belongs to you and to protect your email with SPF, DKIM, and DMARC, among other things. This article explains what a TXT record is, what you use it for, how its content is structured, and how to create and check one yourself, both at LJPc and with another DNS provider.
What is a TXT record?
A TXT record (TXT is short for text) is one of the standard record types in the Domain Name System (DNS), the system that translates domain names into IP addresses and other data. The record type was defined back in 1987 in RFC 1035, one of the original DNS specifications.
A TXT record was originally meant for free, human-readable text about a domain, such as a short note. These days it almost always holds machine-readable information: short lines of text that other systems read automatically. The record does not change your website or your email itself, but it gives other parties a reliable way to verify something about your domain.
What do you use a TXT record for?
A TXT record can be used for many things. Here are the most common use cases.
Domain verification
Many online services want to be sure that you really own a domain before they let you use them. Think of Google Search Console, Microsoft 365, or an advertising or social media platform. The service gives you a unique verification code, also called a token. You add that token to your DNS as a TXT record. The service reads the record, sees the correct code, and knows that you have access to the domain.
Email security with SPF, DKIM, and DMARC
The best-known use is email security. Three widely used standards are all published as a TXT record:
- SPF (Sender Policy Framework) defines which servers are allowed to send email on behalf of your domain. You publish one SPF record per domain, and it starts with
v=spf1. - DKIM (DomainKeys Identified Mail) adds a digital signature to your messages. The matching public key lives in a TXT record at a name such as
selector._domainkey.yourdomain.com. At LJPc, that isdefault._domainkey.yourdomain.com. - DMARC (Domain-based Message Authentication, Reporting and Conformance) tells receiving servers what to do with email that fails the checks. This record lives at
_dmarc.yourdomain.com.
Together, these three standards help prevent someone from sending email that appears to come from your domain. With a hosting package at LJPc, we already add an SPF, DKIM, and DMARC record to your zone by default. If another service also sends mail on behalf of your domain, update the existing SPF record instead of creating a second one. How the three work together is explained in email security.
Other uses
A TXT record also shows up in other techniques. A few examples:
- Requesting an SSL certificate through DNS validation, the so-called ACME DNS-01 challenge used by Let's Encrypt among others, at a name such as
_acme-challenge.yourdomain.com. - BIMI, which can display your brand logo next to your email in the recipient's mailbox.
- MTA-STS and TLS-RPT, which improve the transport security of email.
The mechanism is always the same: a piece of text in DNS that another system reads.
What does a TXT record look like?
A TXT record consists of the same basic fields as other DNS records, plus the text value itself.
| Field | What it means |
|---|---|
| Name (host) | The name the record is attached to. An @ or an empty field points to your main domain (the root). For specific purposes you use a subname, such as _dmarc or selector._domainkey. |
| Type | This is set to TXT. |
| TTL | Time to live: how long (in seconds) other servers may remember the record before they look it up again. Common values range from 3600 (one hour) to 86400 (one day). |
| Value | The text itself. In a zone file it is enclosed in straight double quotes. In an input field, such as in Plesk or the customer portal, you enter the text without quotes. |
So in a zone file, the value of a TXT record is a character string in quotes. A single string can be at most 255 characters long. That is fine for short records, but a DKIM key is often longer. Such a long value is therefore stored in several chunks of up to 255 characters, each in its own set of quotes. The software that reads the record joins those chunks back together into one whole. At LJPc, you paste the entire value into the field in one go: we split it into chunks of 255 characters automatically.
In a zone file, a few common TXT records look like this:
; Domain verification on the main domain
@ IN TXT "google-site-verification=AbC123exampletoken"
; The SPF record LJPc sets by default
@ IN TXT "v=spf1 include:_spf.ljpc.network -all"
; A DMARC record on a subname
_dmarc IN TXT "v=DMARC1; p=quarantine;"
In your provider's control panel you usually do not see a zone file, but separate input fields for the name, the TTL, and the value.
Creating a TXT record yourself
Creating a TXT record takes a few steps with almost any provider. The exact screen names vary by hosting company or domain registrar, but the idea is the same everywhere.
Where do you do this at LJPc?
Where you create a TXT record depends on your package:
- Hosting package: you manage the DNS in Plesk, under the DNS Settings of your domain. From the customer portal, you open Plesk without logging in separately. How that works is explained in open Plesk from the customer portal.
- DNS management only: you manage the records in the customer portal. Open the Domains page in the Services menu, click your domain, and click Add record under DNS records. Choose TXT as the Type, fill in the Name and the Content, and click Save.
Your records at LJPc work as soon as your domain uses LJPc's name servers: ns1.ljpc.network, ns2.ljpc.network, and ns3.ljpc.network. If your name servers are with another provider, you create the record there. How to switch is explained in change your nameservers. Not sure which route applies to you? Open your domain in the portal: if it says that the DNS records for this domain are managed in Plesk, you use Plesk. The complete step-by-step guide for both routes is in manage DNS records.
The steps
- Log in to the control panel provided by whoever manages your DNS. At LJPc that is Plesk or the customer portal; elsewhere it is usually your hosting provider or your domain registrar.
- Open the DNS management or zone editor for the correct domain.
- Choose to add a new record and select
TXTas the type. - In the name or host field, enter where the record should go. Use
@or leave the field empty for the main domain, or enter a subname such as_dmarc. - Paste the value you received or prepared into the value field (in the customer portal it is called Content). Copy the text exactly, in one go and without quotes. In the customer portal, quotes you type yourself become part of the text, and then the value is no longer correct.
- Set a TTL or leave the default value in place. In the customer portal that is 3600 seconds (one hour).
- Save the record.
After that, wait for the change to take effect.
How long until a TXT record works?
At LJPc, a new or changed record usually reaches our name servers within a minute. Servers that still have the old value in their cache only see the new one once the TTL expires, which at LJPc is usually after an hour. The same applies if a service already looked up the record before it existed, for example because you started a verification too early: try again within an hour. With another DNS provider, the TTL largely determines how quickly it goes; if it is set to one day, it can also take a day. If you plan to change a record soon, lower the TTL in advance. Read more in DNS propagation.
How to check a TXT record
You can check for yourself whether a TXT record is correct and already visible. On Windows you use the command prompt, and on macOS and Linux the terminal.
- Windows:
nslookup -type=TXT yourdomain.com - macOS and Linux:
dig TXT yourdomain.com +short
You will then see the text value or values attached to that name. For a record on a subname, enter the full name, for example dig TXT _dmarc.yourdomain.com +short. Want to see what is on LJPc's name servers, without a cache in between? Then ask ns1.ljpc.network directly: dig TXT yourdomain.com @ns1.ljpc.network +short, or on Windows nslookup -type=TXT yourdomain.com ns1.ljpc.network. There are also free online tools that let you look up a TXT record from several locations at once. Read more about these commands in troubleshoot DNS problems.
Common mistakes and how to fix them
| Problem | Cause | Fix |
|---|---|---|
| The record is not found | The change has not propagated yet, or you edited the wrong name | Wait until the TTL has passed and check that the name (host) is correct |
| The text is cut off | The value is longer than 255 characters and is stored as a single string at another DNS provider | At LJPc, we split long values automatically. With another provider, split the value into chunks of up to 255 characters, each in its own set of quotes, if the panel does not do this for you |
| SPF does not work | There are multiple SPF records on the same domain | Merge them into one SPF record that starts with v=spf1. At LJPc, there is already an SPF record: add the new sender to it |
| Quotes in the value | You typed quotes yourself. In the customer portal they become part of the text | Remove the quotes and save the record again |
| Verification fails | A typo or an extra space in the token | Copy the code again and paste it exactly |
So with a TXT record you handle important things like domain verification and email security with a single line of text in your DNS. Still stuck? Create a support ticket and we will look into it with you.
Frequently asked questions
What is a TXT record in DNS?
A TXT record is a DNS record that attaches text to your domain. Other systems read that text, for example to check whether a domain belongs to you or to secure email with SPF, DKIM, and DMARC.
Where do I create a TXT record at LJPc?
With a hosting package, in Plesk under the DNS Settings of your domain. If you only have DNS management at LJPc, you add the record in the customer portal: open the Domains page in the Services menu, click your domain, and choose Add record.
How many TXT records can a domain have?
You can place multiple TXT records on the same name, for example different verification codes on your main domain. The important exception is SPF: a domain may have only one SPF TXT record, otherwise it breaks. At LJPc there is already an SPF record; extend it instead of adding a second one.
What is the maximum length of a TXT record?
A single string in a TXT record can contain at most 255 characters. A longer value, such as a DKIM key, is stored in multiple strings that the reading software joins back together. At LJPc, you paste the entire value into the field in one go; we split it automatically.
How long until a TXT record is active?
At LJPc, a new or changed record usually reaches our name servers within a minute. Servers that still have the old value in their cache only see the change once the TTL expires, which at LJPc is usually after an hour.
How do I check a TXT record?
On Windows you use nslookup -type=TXT yourdomain.com, and on macOS or Linux you use dig TXT yourdomain.com +short. There are also online tools that let you look up a TXT record from several locations.
What is the difference between a TXT record and an SPF record?
An SPF record is no longer a separate record type, but a TXT record with specific content that starts with v=spf1. The old, dedicated SPF record type has been deprecated, so you always publish SPF as a TXT record.