• Docs
  • Talk to an expert
Blog
Blog
BlogProductCase studiesNewsInsights
Blog

What is DNS? A, CNAME, and TXT records explained

infrastructureconfigurationdeployment
25 November 2026
Share

TL;DR

  • DNS, the Domain Name System, translates domain names like example.com into the numeric addresses computers use to find each other.
  • DNS records are instructions stored for a domain. Each type does a different job.
  • An A record points a name to an IP address. A CNAME record points a name to another name. A TXT record holds text, often to prove you own a domain or to protect email.
  • A CNAME can't be used on the bare domain, such as example.com without www. Many DNS providers offer ALIAS or ANAME records to fill that gap.
  • DNS changes aren't instant. Depending on the settings, they can take from minutes to a couple of days to reach everyone.
  • To point a domain at Upsun Cloud, you add records pointing to your project's target address (an ALIAS or ANAME record for the bare domain and a CNAME for subdomains such as www), then add the domain to the project.

DNS is the internet's address book. When you type a website's name into a browser, DNS looks up where that website actually lives and sends the browser there.

Many people only deal with DNS when connecting a domain to a website or an email service, and then the jargon arrives all at once: A records, CNAMEs, TXT records, TTLs. This guide explains how DNS works, what the common record types do, and how to point a domain at your site.

How DNS works

Key takeaway: DNS looks up a domain name and returns the address of the server behind it, then remembers the answer for a while.

Computers find each other using IP addresses, such as 203.0.113.10. People use names, such as example.com. DNS connects the two. When you visit a site:

  1. Your browser asks a DNS resolver, usually run by your internet provider or a public service, for the address of example.com.
  2. If the resolver doesn't already know, it asks a chain of DNS servers until it reaches the one responsible for example.com, called the authoritative name server.
  3. That server answers with the address, and the resolver passes it back to your browser.
  4. The browser connects to that address, and the resolver remembers the answer for a set time so the next lookup is instant.

The authoritative name server is usually run by your DNS provider, which is often the company you bought the domain from, called the registrar. Its settings are where you add and edit your domain's records.

Common DNS record types

Key takeaway: each record type answers a different question about a domain.

RecordWhat it doesExample
APoints a name to an IPv4 addressexample.com → 203.0.113.10
AAAAPoints a name to an IPv6 addressexample.com → 2001:db8::10
CNAMEPoints a name to another name, which is then looked up in turnwww.example.com → example.hosting-provider.com
MXSays which servers receive email for the domainexample.com → mail.example.com
TXTHolds text, used for verification and email securityv=spf1 include:_spf.example.net ~all
NSSays which name servers are authoritative for the domainexample.com → ns1.dns-provider.com
CAASays which certificate authorities may issue certificates for the domainexample.com → letsencrypt.org
ALIAS or ANAMEWorks like a CNAME but can be used on the bare domain. Offered by some providers, not part of the DNS standardexample.com → example.hosting-provider.com

A record vs CNAME record

Key takeaway: an A record points to a fixed address. A CNAME points to a name, so it follows the address wherever it moves.

An A record says "this name lives at this IP address". It's simple, but if the server's address changes, you have to update the record yourself.

A CNAME says "this name is the same as that other name". The lookup follows the other name to find the address. Hosting platforms often ask for a CNAME, because they can move your site to new servers and update their own name without you changing anything.

There's one important restriction: a CNAME can't sit on the bare domain, also called the apex or root, such as example.com. The apex must hold other records, such as the domain's name servers, and the DNS rules don't allow a CNAME alongside them. That's why providers created ALIAS and ANAME records, which behave like a CNAME but are allowed at the apex.

What TXT records are used for

Key takeaway: TXT records let services check that you control a domain, and they protect your domain's email from being faked.

A TXT record holds a piece of text that other services read. Common uses include:

UseWhat the TXT record contains
Proving ownershipA code from a service, such as a search console or certificate provider, that shows you control the domain
SPFA list of servers allowed to send email for your domain
DKIMA public key that lets receivers check your emails weren't altered
DMARCInstructions for what receivers should do with email that fails those checks

A domain can have many TXT records at once, so adding one for a new service doesn't affect the others.

TTL and DNS propagation

Key takeaway: DNS answers are remembered for a set time, so changes can take a while to reach everyone.

Every record has a TTL, short for time to live: the number of seconds resolvers may remember it. A TTL of 3600 means one hour. Until it runs out, some visitors may still be sent to the old address after you change a record. This delay is often called DNS propagation.

Before changing an important record, lower its TTL a day ahead, for example to 300 seconds. Make the change, check everything works, then raise the TTL again.

Common DNS mistakes

Key takeaway: many DNS problems come from conflicting records, the apex rule, or impatience.

MistakeWhat happensHow to avoid it
A CNAME on the bare domainThe provider rejects it, or email and other records stop workingUse an ALIAS or ANAME record, or redirect the bare domain to www
A and CNAME records for the same nameConflicting answers, or the provider refuses the changeKeep one type of record per name
Forgetting the www versionexample.com works but www.example.com doesn't, or the other way aroundAdd records for both, and redirect one to the other
Changing records with a long TTLVisitors reach the old server for hoursLower the TTL before the change
Deleting old TXT recordsEmail starts landing in spam, or a service loses verificationCheck what each TXT record is for before removing it

Pointing a domain at Upsun Cloud

Key takeaway: on Upsun Cloud, you point your domain at your project's target address with a CNAME record, then add the domain to the project.

The Upsun docs on setting up a custom domain describe three steps.

1. Get your project's target. Run upsun environment:info edge_hostname, or copy the CNAME record value from your production environment's Domains settings in the Console.

2. Add DNS records at your DNS provider. Lower the TTL first, then point your domain at the target: an ALIAS or ANAME record for the bare domain, and a CNAME for www if you use it:

NameRecord typePoints to
example.comALIAS or ANAMEYour project's target
www.example.comCNAMEYour project's target

If your provider doesn't allow any of these on the bare domain, the docs describe workarounds: forwarding the bare domain to www, or using a redirection service.

3. Add the domain to your project. Run upsun domain:add example.com, or add it under Domains in the Console.

Once DNS points to your project and your routes use HTTPS, Upsun Cloud issues a free certificate for the domain automatically. Our guide What is an SSL/TLS certificate? explains how that works. A few details from the docs are worth knowing:

  • DNS changes can take anywhere from 15 minutes to 72 hours to take effect, depending on your provider and TTL.
  • Adding a custom domain switches off the automatically generated address for production only. Preview environments keep theirs.
  • Redirects, such as from www to the bare domain, are handled in your routes configuration rather than in DNS.
  • If you use a CDN, you point your DNS at the CDN and the CDN at your project instead.

You can deploy on Upsun Cloud free for 15 days, with no card needed, or read the full guide to setting up a custom domain.

Frequently asked questions

What does DNS stand for?

Domain Name System. It translates domain names into the IP addresses computers use to connect.

What is the difference between an A record and a CNAME?

An A record points a name directly to an IP address. A CNAME points a name to another name, whose address is then looked up.

Why can't I use a CNAME on my root domain?

The root domain must hold other records, such as its name servers, and DNS rules don't allow a CNAME alongside other records. Use an ALIAS or ANAME record if your provider offers one, or redirect the root domain to www.

How long do DNS changes take?

Often minutes, but it can take up to a couple of days, depending on the record's TTL and how long resolvers remember old answers.

What is a TXT record used for?

Proving you own a domain to services such as search consoles and certificate providers, and protecting your email with SPF, DKIM, and DMARC.

How do I check a domain's DNS records?

Use an online DNS lookup tool, or run dig example.com on macOS or Linux, or nslookup example.com on Windows.

Stay updated

Subscribe to our monthly newsletter for the latest updates and news.

Deploy possibility.
Try Upsun for free.

Build with DispatchDeploy on Cloud