What are DNS Records and its types? – Ultimate Guide

DNS Records

What is DNS? 

DNS Records – “Domain Name System” is what “DNS” stands for. It is a mechanism that gives you the ability to connect to websites by associating human-readable domain names with a unique ID of the server on which a website is kept. 

At its most basic, DNS is a list of names and numbers that go together. In this case, the numbers are IP addresses. Computers use IP addresses to talk to each other. Imagine the DNS system as the phone directory for the internet. Instead of listing names and phone numbers for individuals, it lists domain names together with the matching identifiers known as IP addresses. A user’s device looks up the IP address and links them to the location where the website is physically kept when they type a domain name into it. 

What does DNS Records mean?  

A DNS records is a database record used to map a URL to an IP address. DNS records are stored in DNS servers and work to help users connect their websites to the outside world. When the URL is entered and searched in the browser, that URL is forwarded to the DNS servers and then directed to the specific Web server. This Web server then serves the queried website outlined in the URL or directs the user to an email server that manages the incoming mail.

The most common record types of DNS are NS (name server), A (address), CNAME (canonical name), MX (mail exchange), and TXT (text record). To find out more about each record, please read the below.  

What are DNS record types?

DNS records are providing important information about a hostname or domain. These records include the current IP address for a domain.

Also, DNS records are stored in text files (zone files) on the authoritative DNS server. The content of a DNS records file is a string with special commands that the DNS server understands.

DNS record types

The following are the five major DNS record types:

  • Nameserver (NS) record
  • A record
  • CNAME record
  • TXT (text record)
  • Mail exchange (MX) record

The use for each of the above types varies. So let’s look at more details about each DNS records type.

1. Nameserver (NS) record

A nameserver (NS) record specifies the authoritative DNS server for a domain. In other words, the NS record helps point to where internet applications like a web browser can find the IP address for a domain name. Usually, multiple nameservers are specified for a domain.
For example, these could look like,
ns1.examplehostingprovider.com.
ns2.examplehostingprovider.com.

Use of NS record

If you’ve purchased a web hosting service or set up a simple website, you probably received an email with nameserver details. Those nameservers, in simple terms, connect your domain name to the actual server your site is hosted on. The nameserver contains other DNS records for the domain like an A record and MX record.

2. A record

The A record is the most important DNS records type. The “A” in A record stands for “address.” An A record shows the IP address for a specific hostname or domain.

Use of a record

The main use of A record is for IP address lookup. Using an A record, a web browser is able to load a website using the domain name. As a result, we can access websites on the internet without knowing their IP addresses.

Another use of A record is in the domain name system-based blackhole list (DNSBL). Here, the A record is used to block mail from known spam sources.

3. CNAME record

CNAME—or, in full, “canonical name”—is a DNS record that points a domain name (an alias) to another domain. In a CNAME record, the alias doesn’t point to an IP address. And the domain name that the alias points to is the canonical name. For example, the subdomain ng.example.com can point to example.com using CNAME. Here example.com points to the actual IP address using an A record.

Use of CNAME record

A practical example for the use of CNAME records is running multiple subdomains for different purposes on the same server. For example, we can use ftp.example.com for file transfer protocol (FTP) and serve webpages via www.example.com. We can then use a CNAME record to point both subdomains to example.com. The main domain example.com then points to the server’s IP address using an A record.

It’s also possible to point a CNAME to another CNAME. However, doing so is inefficient and can lead to slow load speed and poor user experience.

4. TXT (text record)

Provides the ability to associate other services, or sometimes your mail service, to your domain. This is to help humans using words recognize which server (or software) is using their system. You can add many TXT records to describe other numerical ideas.

Some places you might see a TXT record are with an SPF (Sender Policy Framework), DKIM (DomainKeys Identified E-mail), and DMARC (Domain-based Message Authentication, Reporting, and Conformance) purposes. 

Most DNS hosting providers give clear instructions if you need to change these records, or better still, provide automatic transfer tools to help you out. You can watch Namecheap’s easy video explainer to add a TXT record to my domain or follow any of the links in the previous paragraph if you need to add an SPF, DKIM, or DMARC TXT record.

Use of TXT record

Allows administrators to add limited human and machine-readable notes and can be used for things such as email validation, site, and ownership verification, framework policies, etc., These records don’t require specific formatting.

5. Mail exchange (MX) record

A mail exchange (MX) record is a DNS record type that shows where emails for a domain should be routed to. In other words, an MX record makes it possible to direct emails to a mail server.

You can have multiple MX records for a single domain name. And what this means is that you can have backup email servers. The following shows an example of a domain with multiple MX records:

NameType​PriorityRDATA
@MX10mx.zoho.com
@MX20mx2.zoho.com

From the above table, the MX record with priority 10 will be the primary mail server, while the secondary server will only be used when the primary server is unavailable (or fails to send emails). The lower the priority value, the higher the actual priority.

Use of MX record

With an MX record, it’s possible to hand off emails to a dedicated email server. For example, you can decide to leave all the trouble of setting up webmail on a server you own to a specialized email provider. This comes with many benefits, including custom email clients for reading and sending emails, and improved security and spam filters.

Other DNS Record Types

In addition to the commonly known A and CNAME records, the Domain Name System encompasses a variety of other record types, each serving specialized functions. Here are other types of DNS Records and their uses:

  • AAAA Record: The AAAA record is used in the DNS to map a domain name to the IP address of a computer hosting that domain’s services, specifically for IPv6 addresses. Unlike the more common A record, which maps to IPv4 addresses, AAAA records ensure compatibility and connectivity in networks that use the newer IPv6 protocol.
  • SOA Record: The Start of Authority (SOA) record holds essential administrative information about a domain, including the primary name server, the email of the domain administrator, and various timers related to refreshing the zone. It acts as a fundamental record in DNS, indicating authoritative information about a domain and guiding how DNS should handle changes.
  • PTR Record: The Pointer (PTR) record, often used in reverse DNS lookups, maps an IP address to a domain name, the opposite of what A or AAAA records do. It’s primarily used for verifying the legitimacy of an IP address, ensuring that the IP indeed corresponds to a particular domain, which is particularly useful for email servers to combat spam.
  • SRV Record: The Service (SRV) record identifies the hostname and port number for specific services within a domain, such as email, VoIP, or IM. It provides information on the location of servers for specific services, enabling the segregation and easy access to various services hosted on the same domain but potentially on different machines.
  • CERT Record: The CERT record in DNS is used to store encryption certificates—like PKIX, SPKI, PGP, and so forth—associated with a domain name. These records play a vital role in securing communications and authenticating entities within a domain, essential for secure email exchanges and other secure communications.
  • DHCID Record: The DHCP ID (or DHCID) record is used in DNS to provide a way to associate an IP address with the identifier of a DHCP client. This record is useful for preventing conflicts between DNS and DHCP and for supporting dynamic DNS updates, especially in networks with a mix of static and dynamic IP addresses.
  • DNAME Record: The DNAME (Delegation Name) record is used for DNS redirection, redirecting queries for a domain and all of its subdomains to a different domain. It’s like a broader version of the CNAME record, useful for domain migrations or consolidating multiple domain names under a single domain.