The canonical name in DNS: what is it used for and how to create it?

To map one domain to another, you need a CNAME, which is a DNS record. What is cname in domain? Canonical name record is similar to ALIAS record and resembles redirect, but there are significant differences. Here is what you need to know about a CNAME record and how to create it.

is*hosting team 11 Feb 2023 4 min reading
The canonical name in DNS: what is it used for and how to create it?

At the beginning of working with an online resource, everyone is faced with DNS records. We have already talked about how the Domain Name System works, but today we are going to discuss one of the records - CNAME (canonical name) and the purpose of CNAME.

What is a CNAME record?

A CNAME record, or canonical name (cname) record, is a DNS record used to map one domain name to another. In other words, canonical names and aliases.

The CNAME record format: CNAME

The answer to a canonical name query might look like this: canonical name =

Canonical name in DNS can be presented as follows (canonical name examples):

Domain (subdomain) / Host

DNS Record






CNAME makes it easy to use multiple services (for instance, ftp or mail) from the same IP address. If you change the IP, you need to set up only the A record.


There are also ANAME and DNAME records. ANAME, also known as ALIAS, is an alternative to CNAME with its own advantages. DNAME record provides redirection from one part of the DNS name tree to another (for example, to redirect traffic from the old to the new

How does CNAME work?

When you enter into the address bar, the DNS server starts searching for the A record. After the CNAME record is found, the query is restarted and the canonical domain name ( is used instead of the original one ( This happens because is a subdomain of As a result, the required IP address will be found through the A record of

The query can be set to search for CNAME records first. In this case, the response will be the canonical name (cname), not the IP.

What is CNAME record used for?

what is a cname

Use cases of the CNAME (canonical name) are not limited by this list. CNAME record used for various tasks:

  • to specify multiple domain names (for example, multiple sites) that belong to the same company and must be pointed to the main website;
  • to use different network services and to indicate the root domain;
  • to map each foreign version of the site to the main (canonical) domain;
  • to set up a CDN (Content Delivery Networks) with the CNAME record for the main server.

How to set  CNAME record with restrictions?

When writing the CNAME record, you should consider the following restrictions:

  • The CNAME record cannot be created for the main domain, as the main domain (the canonical name itself) must be mapped to an IP. Instead, you need to create an A record;
  • CNAME records must be pointed to the canonical domain, not to the IP;
  • If you write a CNAME record for a particular subdomain, there must be no other resource records. The exceptions are RRSIG and NSEC;
  • CNAME records mapping to other records of the same type are not recommended due to inefficiency and unresolvable loops;
  • MX and NS records must never point to a CNAME;
  • Domains used in SMTP MAIL and RCPT protocol commands may not have a CNAME record. Existence of this record may cause services to work incorrectly.

Let's create a canonical name (cname) record:

  1. Go to the host site, to the DNS management console, and then to all records.
  2. If you have several domains, choose the one that you want to make a CNAME record for (
  3. In the list of records, select the CNAME type.
  4. Enter the subdomain in the Host field (
  5. Fill in the TTL (Time to Live) field, which specifies how long the record will be kept in the cache of systems that request it. You may leave this parameter by default, however it is recommended to set 1800 or higher for static IPs and 1800 or less for dynamic IPs.
  6. Save changes.

We remind you, it can take up to 72 hours for new records to work.

How to check CNAME online 

how to check a cname

On the Internet, you can find services called CNAME Lookup. These services, after entering the domain, will provide a list of CNAME records in order of priority.

Some tools allow you to see not only CNAME, but also other records:

Another way is to use the nslookup application, which is available on Windows, MacOS, and Linux.

So, to check the CNAME on MacOS or Linux, start a terminal. On Windows, you need to run the command line (Start → Run, type cmd and press Enter).

Then enter the command with the desired subdomain:

nslookup -q=cname

The app will give you information:



Non-authoritative answer: canonical name =

That is, points to the canonical name (cname)

 A record vs CNAME vs ALIAS record vs Redirect

dns records cname

In the domain name system, CNAME, A, and ALIAS records may look similar, but you should know their key differences. Owners of websites or other online projects are faced with each type of record during the initial work with domains.

The difference between A record and CNAME record is that A record is used to map a root domain to an IP address. This is the main difference because in the CNAME record, you can only map one domain ( to another ( Subdomains with CNAME records cannot have A records.

Just like the CNAME, the ALIAS maps one domain to another. However, CNAME doesn't allow adding other resource records for these domains. But with ALIAS, it is possible. Also, an ALIAS query immediately returns an IP address, without mediating with another domain name. This reduces the processing time for the query.

Redirect and CNAME are not directly related. To create a redirect, you need to configure the server so that it will give a specific response for a specific HTTP request. CNAME cannot guarantee it.


Choose the suitable configuration and enjoy all the benefits of a virtual private server.

From $4.99/mo
Dedicated Server

​​Smooth operation, high performance, and user-friendly setup - it's all there for you.

From $9.99/mo