What is a CNAME (canonical name) record?

CNAME

A CNAME record, or canonical name record, serves as an alias within the Domain Name System (DNS), redirecting one domain name to another.

It allows multiple domain names to resolve to the same IP address and simplifies the process of managing various services or subdomains by pointing them to a single destination domain. Notably, all CNAME records must direct to a domain name rather than an IP address.

The ”www” subdomain is a common CNAME example. It is provided as an alias to the root domain name, and users accessing “www.example.com” are referred to the root domain (or DNS zone apex) “example.com”.

The canonical name record might sound complex, but it’s a relatively simple, helpful tool in the world of the internet and DNS. Imagine DNS as a huge naming database, like a phonebook, responsible for connecting familiar website names like “www.example.com” to the actual internet protocol (IP) addresses, which is a unique set of numbers. CNAME records help organizations manage domains, distribute and balance traffic more efficiently, and ultimately deliver a faster, more seamless user experience.

Common Uses

Some of the most popular scenarios for implementing CNAME record are the following:

  • Providing a separate hostname for specific services, such as email or FTP, and pointing that hostname to the root domain.
  • Registering the same domain in several countries and pointing the country versions to the main “.com” domain
  • Pointing from several websites owned by the same organization to a primary website

CNAME record format

The structure of a CNAME record follows the standard top-level format definition defined RFC 1035. The RDATA section is composed of one single element:

ElementDescription
domain-nameA domain name which specifies the canonical or primary name for the record.

The canonical representation is:

CNAME <domain-name>

where <domain-name> is a fully-qualified domain name such as example.com.

In DNSimple, the CNAME record is represented by the following customizable elements:

ElementDescription
NameThe host name for the record, without the domain name. This is generally referred to as “subdomain”. We automatically append the domain name.
TTLThe time-to-live in seconds. This is the amount of time the record is allowed to be cached by a resolver.
ContentThe domain-name the CNAME maps to.