A record and CNAME record: What is the difference?

Both A record and CNAME record are some of the most popular DNS (Domain Name System) records. However, they serve very different purposes, which are essential to understand. So, let’s explain a little bit more about the A record and CNAME record.

Why do you need a CNAME record?

A record – Definition

The A record is a DNS resource record which can be called also address record. It plays a very important role. For that reason, it is probably the most known DNS record. It links a domain name to its accosted IP address. We should note that the A record is able to link only to an IPv4 address. For the newer version IPv6 addresses, there is a different DNS record – AAAA record. 

You are going to need the A record in case you want your domain name to function properly. You can add it in a very simple way into your Primary (Master) DNS zone.

Here is an example of an A record:

  • Host: yourwebsite.com
  • Type: A
  • Points to: 122.51.47.123
  • Time-to-live (TTL): 1 Hour

CNAME – Definition

The CNAME record, also known as Canonical Name record, is another very useful DNS record. It has an essential purpose too. The CNAME record indicates that a particular domain or subdomain (hostname) is simply a different way of saying the primary domain name (hostname), which is referred to as the canonical domain.

There are a lot of different situations in which you would want to use the CNAME record. Yet, the most accurate way to use it is only for your subdomains. For instance, www.yourwebsite.com to link to yourwebsite.com or subdomain.yourwebsite.com to yourwebsite.com.

It is important to remember that once you create a CNAME record and add it to a particular DNS zone, you should not add any additional DNS records for that zone. It simply won’t function. In case you want to avoid that and have a similar effect, meaning pointing one hostname to another, there is a different DNS record that could serve you. That is the ALIAS record which allows you to add other DNS records, such as MX records.

Here is an example of a CNAME record:

  • Host: www.yourwebsite.com
  • Type: CNAME
  • Points to: yourwebsite.com
  • Time-to-live (TTL): 1 Hour.

A record and CNAME record: Differences

A record and CNAME record are very different. They both serve different purposes. Yet, people still misunderstand their functions. So, to make things a little bit clear, let’s briefly explain the contrast between the two DNS records.

The A record points one domain name to its IPv4 address, and the CNAME record connects one subdomain to a domain name.

The A record is able to exist with additional DNS records, including other A or AAAA records in the very same DNS zone. You could improve the redundancy with them and use them for load balancing. 

On the other hand, the CNAME record is not able to function with additional records, including another CNAME record.

Conclusion

So, now you know what the main differences between the A record and CNAME record are. Make sure to use them properly!

Leave a Comment

Your email address will not be published. Required fields are marked *