About Contact Careers Launching Soon System Status Legal

Article · Domains

What Is DNS? A, CNAME, MX and TXT Records Explained

Every time someone types your domain name, the internet has to work out which server holds your website. DNS, the Domain Name System, does that job. Cloudflare's learning centre describes it as the phonebook of the internet: it translates names people remember into the numeric addresses that computers use.

If you have ever been told to "add a record" or "wait for DNS to update", this article explains what that means.

How a DNS lookup works

A lookup takes a few quick steps. Your browser asks a recursive resolver, usually run by your internet provider. If the resolver does not already know the answer, it asks a root server, which points to the server for the domain's ending, such as .lk or .com. That server points to your domain's authoritative nameserver, which holds the real records and gives back the address.

Answers are saved, or cached, along the way in your browser, your device and your provider's resolver. That makes browsing faster, and it is also why changes take time to appear. See how to clear your browser and DNS cache if you still see old results.

The records you will meet

A domain's DNS settings are a list of records. Here are the common ones, in the words Cloudflare uses in its DNS records guide.

Record What it does Typical use
A Holds the IP address of a domain Points your domain to your web server
AAAA Holds the IPv6 address for a domain The same job as A, for the newer address format
CNAME Forwards one name to another name, and does not give an IP address Pointing www to your main domain
MX Directs mail to an email server Telling the world where your email goes
TXT Lets an admin store text notes in the record Email security settings such as SPF and DKIM
NS Stores the name server for a DNS entry Saying which servers manage your records

Our article on SPF, DKIM and DMARC shows what goes in the TXT records for email.

Nameservers: who looks after your records

Your domain's nameservers decide where its DNS records live. If you use your hosting company's nameservers, you manage the records in your hosting control panel. If you keep the nameservers at your domain registrar, you manage them there. Only one place is in charge at a time, so records added in the wrong place do nothing.

This is also why the domain and the hosting are separate things. Our article on domain name vs web hosting explains the difference.

What TTL means

Every record has a TTL, short for time to live. Cloudflare explains that it indicates how often a DNS server will refresh that record. A low TTL means changes spread faster, and a high TTL means fewer lookups. If you plan to move a site, ask whether you can lower the TTL a day before.

A simple example

Imagine yourbusiness.lk:

  1. An A record sends yourbusiness.lk to your web server's address.
  2. A CNAME record sends www.yourbusiness.lk to yourbusiness.lk.
  3. MX records send email to your mail server.
  4. A TXT record tells receiving servers which servers may send email for you.
  5. NS records show which nameservers manage all of the above.

Check your own records

You do not need special tools. Follow how to check that your domain points to your hosting to run a lookup in about two minutes.

Common DNS problems

  • Your site still shows the old page after a change. The old answer is cached. Wait a few hours and clear your cache.
  • Email stops arriving after you move a site. The MX records were not copied to the new place.
  • A record you added has no effect. The domain uses a different set of nameservers than the one you edited.

FAQ

Is DNS the same as hosting?

No. DNS is the directory that says where your site is. Hosting is the server that stores it.

How long do DNS changes take?

It depends on the TTL and on the caches along the way, so it can be minutes or a few hours. Your own device may show the change before others do.

Can I break my site by editing DNS?

Yes, if you delete or change the wrong record. Write down the current records before you edit, and change one thing at a time. If you are unsure, contact our team before you change anything.

Related reading

Article Domains

What Happens When Your Domain Name Expires?

An expired domain can take your website and email offline, and the name may be released. See ICANN's renewal rules, the grace periods and how to stay safe.