Table of Contents

Among all the DNS records, the TXT record is the quiet workhorse that does two very different but equally important jobs: proving you own your domain, and keeping your email trusted and secure. If you have ever been told to “add a TXT record to verify your domain” or to “set up SPF and DKIM,” this is the record at the centre of it — and understanding it demystifies both domain verification and email deliverability.

This guide explains what a TXT record is, its two main uses, and — most usefully — how the three email-security standards SPF, DKIM, and DMARC work together to prove your messages are genuine and stop scammers from forging your domain. You will also learn how to add a TXT record correctly and why getting the exact value right matters so much.

Animated illustration of website files on a server going live to a website in the cloud

Did you know?

A TXT record simply stores a line of text in your DNS that outside services can read. That flexibility is why it powers everything from one-click domain verification to the SPF, DKIM, and DMARC standards that keep billions of emails trustworthy.

What a TXT record is

A TXT record is a DNS record that holds plain, free-form text associated with your domain, readable by any service that looks it up. Unlike an A record (which points to an IP) or an MX record (which routes email), a TXT record does not direct traffic — it stores information for external systems to read and act on.

That simplicity is its strength. Because a TXT record can contain arbitrary text, it has become the standard way to publish small pieces of machine-readable data about your domain — anything from a verification code to the rules that govern your email security.

You add TXT records in your DNS editor just like any other record, specifying a host (which name it applies to) and the text value. The two things that use TXT records most are domain verification and email authentication, and together they account for nearly all the TXT records you will ever create.

Use one: verifying domain ownership

The first big job of a TXT record is proving you control a domain. When you sign up for a service — an email suite, a marketing platform, a search console, or countless others — the provider often needs to confirm the domain is really yours before enabling features for it.

To do this, they give you a unique TXT record value to add to your DNS. Because only someone with access to the domain’s DNS can add that record, its presence proves ownership. The service checks for the record, sees it, and verifies your domain — a simple, secure handshake.

These verification TXT records are usually a one-time step. Once the service confirms the record, your domain is verified, and you can often leave the record in place or remove it per the provider’s instructions. It is one of the most common reasons people add a TXT record.

Use two: email security and anti-spoofing

The second, increasingly critical job of TXT records is email authentication. Scammers can try to forge your domain in the “from” address of emails (spoofing), and three standards — SPF, DKIM, and DMARC — all published as TXT records — work together to prevent this and prove your mail is genuine.

These standards are what stand between your domain and having your messages land in spam folders or, worse, having criminals impersonate you. Receiving mail servers check them to decide whether an email claiming to be from your domain is legitimate.

Because email providers and hosts increasingly require proper authentication for good deliverability, setting up these TXT records has become an essential part of running email on your own domain. The next sections break down what each one does.

SPF, DKIM, and DMARC at a glance

The three email-security standards each play a distinct role, and they are strongest when used together. Here is what each does:

Email authentication standards

Standard What it does In plain terms
SPF Lists servers allowed to send for your domain “Only these servers may send my mail”
DKIM Adds a cryptographic signature to messages “This message really came from me, unaltered”
DMARC Sets policy for messages that fail checks “Here is what to do with fakes, and report them”

Think of them as a layered defence: SPF says who is allowed to send, DKIM proves a message is authentic and untampered, and DMARC ties them together with a policy and reporting. Used together, they make it very hard for anyone to convincingly forge your domain.

How SPF works

SPF (Sender Policy Framework) is a TXT record that lists the mail servers and services authorised to send email on behalf of your domain. Its value begins with a marker identifying it as an SPF record, followed by the approved senders.

When a receiving server gets an email claiming to be from your domain, it checks your SPF record to see whether the sending server is on the approved list. If it is, the message passes the SPF check; if it is not, the message may be marked as spam or rejected, because it looks like an unauthorised sender forging your domain.

SPF is your first line of defence against spoofing. Keeping it accurate — listing every legitimate service you send from, such as your email provider and any marketing tools — ensures your real mail passes while impostors fail.

How DKIM and DMARC work

DKIM (DomainKeys Identified Mail) adds a cryptographic signature to your outgoing messages, with the matching public key published in a TXT record in your DNS. Receiving servers use that key to verify the signature, confirming the message genuinely came from your domain and was not altered in transit. It is a tamper-proof seal on your mail.

DMARC (Domain-based Message Authentication, Reporting and Conformance) ties SPF and DKIM together with a policy. Published as a TXT record (typically at a _dmarc name), it tells receiving servers what to do with messages that fail SPF and DKIM checks — do nothing, quarantine them to spam, or reject them outright — and can send you reports on authentication activity.

Together, DKIM proves authenticity, and DMARC enforces a consistent policy and gives you visibility. With all three in place — SPF, DKIM, and DMARC — your domain has robust protection against spoofing and strong email deliverability.

How to add a TXT record

Adding a TXT record uses the same pattern as any DNS change. Log in to your DNS provider, open the DNS or zone editor, add a new record, and choose the type TXT. Enter the host (often @ for the root domain, or a specific name like _dmarc for DMARC) and paste the exact text value the service or standard requires.

Precision is everything with TXT records. Because the value is free-form text, a single missing character, extra space, or altered symbol can break verification or email authentication entirely. Always copy the value exactly as provided, and paste rather than retype it where possible.

After saving, allow time for propagation before the checking service or receiving mail servers can read the record. Once it propagates, verification completes or your email authentication takes effect — and your domain is verified, protected, and trusted.

If a verification or authentication check fails, the culprit is almost always the value itself: a truncated string, an extra quotation mark, or a line split where it should not be. Re-open the record, compare it character for character against what the provider gave you, correct any mismatch, and allow another short propagation window before testing again.

Need to verify your domain or secure your email?

Hostinger’s DNS editor makes adding TXT records for verification, SPF, DKIM, and DMARC simple, so you can prove ownership and protect your email from one clear dashboard — with a free domain included on its hosting plans.

See Hostinger plans

FAQs

What is a TXT record?

A TXT record is a DNS record that stores plain, free-form text about your domain for outside services to read. It does not route traffic like A or MX records; instead it publishes machine-readable data. Its two main uses are verifying domain ownership (adding a code a service checks) and email security (holding SPF, DKIM, and DMARC settings).

What are SPF, DKIM, and DMARC?

They are three email-authentication standards, all published as TXT records, that work together to prove your email is genuine and stop spoofing. SPF lists which servers may send mail for your domain, DKIM adds a cryptographic signature verifying messages are authentic and unaltered, and DMARC sets the policy for handling mail that fails those checks and provides reporting.

Why do I need a TXT record for email?

Because email providers increasingly require SPF, DKIM, and DMARC — all stored as TXT records — for good deliverability and to prevent your domain being forged. Without them, your legitimate mail is more likely to land in spam, and scammers find it easier to impersonate you. Proper TXT-based authentication keeps your email trusted and protected.

How do I verify domain ownership with a TXT record?

The service you are setting up gives you a unique TXT record value. You add it to your domain’s DNS, and because only someone with DNS access could add it, its presence proves you own the domain. The service checks for the record, confirms it, and verifies your domain — usually a one-time step during setup.

Why did my TXT record fail?

Almost always because of an exact-value error — a missing character, extra space, or altered symbol — since TXT values are free-form and must match precisely. Propagation delay is the other common cause; the record can take time to become readable. Copy the value exactly (paste rather than retype), save, and allow time before re-checking.

Where do I add a TXT record?

In the DNS editor (zone editor) provided by whoever holds your domain’s nameservers — your registrar or host. Add a record of type TXT, set the host (often @ for the root, or a name like _dmarc for DMARC), paste the exact value required, and save. Allow time for propagation before the record can be read by services or mail servers.

The bottom line

A TXT record stores plain text in your DNS for outside services to read, and it quietly powers two essential jobs: verifying that you own a domain, and securing your email. For verification, you add a unique value a service checks to confirm control of the domain. For email, three standards published as TXT records — SPF, DKIM, and DMARC — work together to prove your messages are genuine and block spoofing: SPF lists authorised senders, DKIM adds a tamper-proof cryptographic signature, and DMARC sets the policy for handling fakes and reports on activity.

Because TXT values are free-form text, the single most important rule is precision — copy the exact value provided, paste rather than retype, and allow time for propagation before it takes effect. Set up correctly, TXT records verify your domain with the services you use and give your email robust protection and strong deliverability, keeping your real mail in inboxes and impostors locked out. They are the small, easily overlooked records that quietly keep your domain trusted.

When you are ready, you can start with Hostinger and use code PROTIPS for the reader discount. A TXT record holds text in your DNS for two jobs: proving domain ownership and securing email. SPF, DKIM, and DMARC — all TXT records — together prove your mail is genuine and block spoofing. Copy values exactly.

Scroll to Top