Skip to main content

What is a TXT record?

A TXT record (Text record) is a DNS record that stores arbitrary text associated with a domain name.

In simpler terms: a TXT record is a place in DNS where you can put text information for services and checks.


Why a TXT record is needed

TXT records are used to:

  • verify domain ownership
  • configure mail security
  • pass service data to external services

A TXT record is not needed to open a site directly, it is needed for infrastructure and security.


The most common uses of TXT records

1. Mail (SPF, DKIM, DMARC)

TXT records are used to protect against spam and email forgery:

  • SPF: which servers are allowed to send mail
  • DKIM: a digital signature for emails
  • DMARC: a policy for handling emails

Without these TXT records, emails may:

  • end up in spam
  • fail to reach the recipient

2. Domain ownership verification

Many services ask:

"Add a TXT record with this code"

This is needed to prove:

  • that you own the domain
  • that you have the right to configure it

3. Service information

TXT can store:

  • tokens
  • keys
  • settings
  • comments for services

DNS just stores the text, the meaning is defined by the service that reads it.


Example of a TXT record

Simplified:

NameTypeValue
example.comTXT"v=spf1 include:_spf.google.com ~all"

Or:

example.com TXT "google-site-verification=abc123"

Important points for an interview

  • a TXT record does not directly affect opening a site
  • one domain can have several TXT records
  • DNS does not interpret the text, it just returns it
  • TXT is often used for security and validation

Real-life example

A TXT record is like:

  • a note attached to an address
  • "for official use only"

The address is the domain The note is the TXT record


Short interview answer

Remember this formulation:

A TXT record is a DNS record intended for storing arbitrary text information, which services use to verify a domain, configure mail, and handle other service tasks.

Short Answer

Interview ready
Premium

A concise answer to help you respond confidently on this topic during an interview.