Types of DNS Records
A Quick Guide to Understanding Different DNS Records: A, AAAA, CNAME, MX, TXT, NS

DNS records are like different types of contacts in a phonebook for computers IP address, it tells what domain name corresponds to which IP address and what type it is. DNS Records are specified and stored in the authoritative DNS servers. It has multiple types and some of the must knowns are explained in the article below.
What is a DNS?
DNS stands for Domain Name System. It is the system that maps the IP addresses of servers to the domain names to make it easy for us to remember the website. It is also known as the phone book of the internet.
Need of DNS Records
DNS Records are the entries inside the phone book or DNS. They are the key value pairs which maps a specific IP address to a domain map. They are of different kinds:
A Record
It stores the IPv4 address of the server where the source files exist for the domain name. All the IPv4 addresses are used up since they are of only 32 bits. So now, IPv6 addresses are used now.
example.com -> 192.0.2.1We get the A record from the authoritative DNS server.
AAAA Record
It stores the IPv6 address the server which contains the source files for the domain name. Here, A represents the capacity of the records which is 32 bits for one A.
example.com -> 2001:db8::1Since, IPv6 addresses are of 128 bits, therefore, AAAA records are used to store it. It is also obtained from the authoritative DNS server.
CNAME Record
It stands for Canonical Name Record. It is used to provide a alias to another domain. It acts as a type of nickname for a domain. It cannot points to a IP address.
It is used in generating sub-domains, when we create a sub-domain like “blog.example.com” we usually defines a CNAME record for it with a value of “example.com”. So when DNS server queries the blog.example.com it looks at the CNAME record and starts another DNS query for the example.com. “example.com” can also contain another CNAME Record which can point to another domain, but it is not advisable since it make the DNS resolution slow. After we get the final domain it gives us the IP of the server.
blog.example.com -> example.comIf a domain has a CNAME record then the domain used in that cannot be used in any other records of that domain the original domain should be used in all other records.
MX Record
It stands for Mail Exchange Record. It is used for directing emails sent to the domain to a mail server. It can have multiple values with different mail servers, it also has a priority value that decides with mail servers gets more traffic. Multiple values helps in reducing the load on a single mail server.
example.com -> mail.example.com (priority: 10)Mail servers with lower priority values gets more load, we can also provide same priority value so that each mail server gets equal load.
TXT Record
It stands for Text Record. It is used by domain administrators to store text in a Domain Name System.
example.com -> "hello world"It helps in the identification of email spams and domain owner verification nowadays. Originally, it was build for storing only text but now it is also used for storing machine readable codes as well. Domain providers generally limits the size of string or number of lines that can be stored in the this record.
NS Record
It stands for Nameserver Record. It tells the address of the authoritative DNS server of the domain which stores all the other records for that domain.
Authoritative DNS server is the server that holds the complete information of the specified domain name. It holds all the original records like CNAME, MX and TXT records of the domain name. We can also specify multiple authoritative DNS server for a single domain name, to do it we have to define multiple NS records for each server. It provides a fallback security for the domain so that if one server goes down the domain still remains active. It can never point to a CNAME record.
example.com -> ns1.dns.comExample for this record can be, whenever we buy a domain from a domain name service. The NS record of our domain points to the nameserver provided by the company. We can also choose and customize which nameserver do we want to use for our domain.