Skip to main content

Command Palette

Search for a command to run...

DNS Record Types Explained

Published
4 min read

The domain name system, or DNS, is a global system responsible for mapping domain names to their corresponding Internet Protocol (IP) addresses. For example, if you want to access a website using a domain name like example.com, that domain name must point to a valid IP address.

The domian name is a string of words that are easy to remember. IP addresses (IPV4), on the other hand, contain numbers separated by dots and are harder to remember. In our example above, example.com is the domain name, while 93.184.216.34 is the current IP address for example.com. Also, note that the IP address associated with a domain name may change depending on the server hosting the website.

What are DNS record types?

DNS record types are records that provide important information about a 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 record file is a string with special commands that the DNS server understands.

DNS record types

The following are the major DNS record types:

  • A record

  • AAAA record

  • CNAME record

  • Nameserver (NS) record

  • Mail exchange (MX) record

  • Txt record

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

  1. A record

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

    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.

  2. AAAA record

    AAAA record, just like A record, point to the IP address for a domain. However, this DNS record type is different in the sense that it points to IPV6 addresses.

    Usage of the AAAA record for DNS resolution has great potential because it uses IPV6, which is an improvement over IPV4. Also, as the internet keeps growing and we're running out of IPV4 addresses, the potential for AAAA records is high.

    AAAA records are used to resolve a domain name to the newer IPV6 protocol address.

  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.

  4. 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 and ns2.examplehostingprovider.com.

  5. 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.

  6. TXT record

    TXT stands for "text," and this record type lets the owner of a domain store text values in the DNS. Several services use this record to verify ownership of a domain.

Common Confusion Points

  1. A vs CNAME :

PointsA RecordCNAME Record
Pointing toIPv4 AddressAnother domain name
PurposeDirectly connects the domain to the serverCreate a different name for the same domain name
EndHere it ends this is the final stepNo you travel to a different name for same domain
Used forMain domain or hosting itDefining subdomains.
Examplewww.example.com → 123.456.789www.example.comexample.com
  1. NS vs MX:

FeatureNS RecordMX Record
FullformNamed Server RecordMail Exchange Record
PurposeShow who manage the particular domain’s DNSSays where the mails for a particular domain should go.
UsesDNS resolveersEmail servers
Examplewww.example.comns1.hosting.comexample.commail.google.com