DNS Record Types Explained
In your day-to-day work, you visit many websites for your research work, assignments, shopping, etc., just by typing the website name, like www.github.com, and you land on that site. That’s simple, right? But on the Internet, a computer does not understand a text? It only understands numbers, which are IP addresses. So in this blog we are going to understand DNS and its types.
Topics to Cover
What is DNS
Why DNS records are needed
What is NS Record
What is A Record
What is AAAA Record
What is CNAME Record
What is MX Record
What is TXT Record
How all DNS records work together for one website
What is DNS ?
DNS stands for Domain Name Service. It is actually a phonebook that translates text (e.g., www.github.com) into numbers, which is IP address.
Computers communicate using these IP addresses on the internet, like 192.168.1.1. This IP address is good for the computer but not for us humans, because we need to memorise this number, which is difficult, so that's why we use text like www.github.com. DNS helps us to translate human readable text like into computer readable form that is IP (Internet Protocol) address.
Why DNS records are needed
Now we have understood what DNS is and what it does. Now we have to understand why we have need DNS records.
DNS records are the instructions stored on DNS servers which tell the internet how to handle requests for a particular domain. It is like a global address book which contains records and provides specific information about the domain like where its hosted, where to send emails, who manages the domain etc. Different types of records serve different purposes. Some records point to the web server, others direct to email traffic, some verify domain ownership.
What is NS Record
NS stands for Name server It basically tell who is authoritative for this domain. It acts as a pointer directing DNS queries to the correct servers that hold the domain’s DNS records such as A, MX, TXT records.
Example for NS Record:
github.com NS ns-1283.awsdns-32.org
github.com NS ns-421.awsdns-52.com
In this example :ns-1283.awsdns-32.org and ns-421.awsdns-52.com are responsible for all DNS decisions for github.com
NS records are usually set at your domain registrar where you bought your domain name, and they point to your DNS hosting provider. This could be the same company, or they might be different services. For example, you might purchase your domain from GoDaddy but use Cloudflare DNS servers to manage your DNS records.
There can be multiple DNS records because if one name server has some issue then the others can still respond to queries which keeps your site accessible.
What is A Record
A stands for Address, A records are probably the most commonly used DNS records. They create a direct mapping from a domain name to IPv4 address. An IPv4 address is 32 bit number usually written as four numbers separated by dots like 192.0.2.1. When you create A record it means that when someone visits this domain name send them to this IP address.
A record basically translates the text (i.e., www.github.com) into an IPv4 number (20.205.243.166) which helps us not to remember these long numbers.
Example for A Record:
www.github.com A 20.205.243.166
github.com A 20.205.243.166
In this example:
Both www.github.com and github.com point to the same IP address
When we type in the browser www.github.com what’s happens :
Your browser asks DNS: What’s the A record for www.github.com?
DNS responds it “20.205.243.166”
Your browser connects to the server at that IP address.
The server sends back the website.
What is AAAA Record
AAAA Records, also known as IPv6 Address Record. Its purpose is same as A record but for IPv6 addresses. IPv6 addresses are 128-bit numbers and it was represented as eight groups of hexadecimal numbers separated by colons like 2600:9000:5305:300::1. They are more complex than IPv4 addresses.
Example for AAAA Record:
github.com AAAA 2620:4d:4000:6259:7:8:0:1
Why is it called AAAA? Because IPv6 addresses are four times larger than IPv4 addresses (128 bits vs 32 bits), so it takes four A's!. In practice, most modern websites have both A records (for IPv4) and AAAA records (for IPv6) to ensure they're accessible to everyone, regardless of which internet protocol version their device uses. This dual-stack approach ensures maximum compatibility.
What is CNAME Record
CNAME Record stands for Canonical Name, it basically acts as an alias. Instead of pointing a domain name to an IP address like an A record does, it points one domain name to another domain name.
Suppose you have a blog, blog.example.com but it is actually hosted on a platform like Medium. Instead of pointing directly to an IP address, we can create a CNAME record that points to the platform domain.
Example for CNAME Record:
blog.example.com. CNAME yoursite.wordpress.com.
When someone visits blog.example.com here, what happens:
DNS looks up blog.example.com and finds the CNAME record.
The CNAME points to yoursite.wordpress.com.
DNS then looks up yoursite.wordpress.com and finds its A record.
DNS returns the IP address from that A record.
The browser connects to that IP address.
What is MX Record
MX Record stands for Mail Exchange, MX records tell email systems where to deliver mail for your domain. When someone sends an email to yourname@gmail.com the sending mail server uses DNS to lookup the MX record for example.com to find out which mail should receive the message.
Example for MX Record:
example.com. MX 10 mail1.mailprovider.com.
example.com. MX 20 mail2.mailprovider.com.
In this example ,the number (10,20) is called the priority. Lower numbers have higher priority, so the sending server will try mail1.mailprovider.com first. If that server is unavailable, it will try mail2.mailprovider.com.
MX records are important for email delivery. Without the correct MX records, emails sent to your domain will bounce back, and senders will get error messages saying the mail couldn't be delivered.
What is TXT Record
TXT Record stands for Text Record is type of DNS record which help domain owner to store text based information in the DNS .
Like other records such as A records or CNAME records,TXT records dont direct traffic to a specific website or serve.Instead they act like a public note attached to you domain that other services can read to verif infoemation or set security policies.
Example for TXT Record:
hashnode.com TXT "v=spf1 mx a:mta-86-54.sparkpostmail.com include:_spf.google.com ~all"
Unlike other records that follow strict formats TXT records can contain almost any text enclosed in quotes. Common uses include domain ownership verification, email security, and service authentication.
How all DNS records work together for one website
Here is the flow how all DNS records work together:
User types
www.github.comDNS checks NS records, finds the right DNS server
DNS sees CNAME, points to
github.comDNS reads A / AAAA records, gets IP address
Browser connects to the server
Website loads