DNS records are an essential part of getting websites to operate correctly. They serve as a map that tells the DNS server (or the digital database that lists every website on the internet) which domain every IP address is associated with, and how they should handle the access requests sent to them.
Various DNS record strings serve as commands on how the server should approach them, and they ensure that your site functions the way you intend it to. Although there are various types of DNS records that all perform different actions, these four record types are the most commonly used.
What is an A record?
Address records, commonly known as host records, resolve IP addresses. They connect the domains you register to the correct IP address so that your website will properly resolve when someone types in your web address.
When do you use an A record?
A records are used when you want to connect a domain name you’ve registered with a hosted website. Usually, two A records are set up that will successfully point to both a bare and wildcard version of the domain (i.e. yoursite.com and http://yoursite.com). Additional A records can also be created for subdomains as well.
What is a CNAME record?
CNAME records, or Canonical Name Records, only resolve to domains and subdomains. Unlike A records, they cannot be bare (i.e. there needs to be www. in front of them for the URL to properly resolve).
When do you use a CNAME record?
Why would you use a CNAME record instead of an A record? Well, CNAME records are most often used when you want to direct part of your website to an external link. For example, if you wanted to set up an eCommerce site to complement your existing website, a CNAME record would be the simplest way to link them together.
What is an MX record?
MX stands for Mail Exchange and is very different from other records. Unlike most DNS records that resolve to text or the destinations of various IP addresses, MX records are used to direct emails sent to custom addresses associated with a domain name.
When do you use an MX record?
If you want to create custom email addresses through your domain name, MX records must be set up so that any emails that go to that address will be directed to the right server and get delivered to you. Typically, your email provider will give you the MX records you need, and then you’ll add it to the domain it’s associated with to finish setup.
What is a TXT record?
As you can probably guess, a TXT record is simply a text record. Although these records cannot be used to change your domain in any way, they are useful for making it easier to search for and find your domain.
When do you use a TXT record?
Text records are most often used by services like Google. By adding certain strings of characters to your TXT file, search engines and other services are able to search for your domain as well as verify that you are the owner of the domain.