CNAME (Canonical Name Record) is a type of DNS entry or resource record that creates an alias from one domain name to another. All CNAME records must always point to a domain, never an IP address.
A common use of CNAME is setting up a newly registered domain name and hosting; the DNS is configured to allow the domain to route or connect to the host server with or without www.
For example:
yourdomainname.com and www.yourdomainname.com can route to the same server without pointing each directly to the server IP.
And when a website has subdomains: blog.yourdomainname.com and shop.yourdomainname.com.
These subdomains will have CNAME records that point to a root domain (yourdomainname.com). This way, if the IP address of the host changes, only the DNS record for the root domain needs to be updated, and all the CNAME records will follow along with the changes made to the root.