Skip to content

CNAME Record: How It Works With DNS and Why It’s Useful

​​If you’ve ever wondered how your browser finds its way to the right online destination, you’ve come to the right place. Today we’ll uncover the magic of CNAME records and their role in the world of domain names.

In this article, we’ll delve into the heart of CNAMEs, understanding how they transform aliases into canonical domain names and serve as essential tools within the Domain Name System (DNS) landscape.

📚 After reading it, you’ll have learned:

Let’s get started!

What is a CNAME record in DNS?

A CNAME record, also known as a Canonical Name record, is a type of record in the DNS that points an alias domain name to a canonical domain name.

For example:

NameRecord typeValue

The table above shows that the domain name (alias) has a CNAME record pointing to (canonical name).

The domain name is associated with an A record, which stands for Address record. This record instructs the DNS server that when someone enters, they should be directed to the IP address associated with, in this case,

CNAME record definition (for non-techies)

If you’re a techie, you probably already got what a CNAME record is. But, to make this topic approachable for a less knowledgeable audience, we’ll use an easier example.

Let’s say you have a friend called Sam. He has two nicknames: “Sammy” and “Samson.”

When someone wants to find his home, people use either of these nicknames instead of saying “Sam’s house” every time. They say, “I’m going to Sammy’s” or “I’m going to Samson’s” instead of “I’m going to Sam’s house.”

However, when people say they’re going to “Sammy’s,” they refer to his house porch, where he usually welcomes guests. When people say they’re going to “Samson’s,” they talk about going to his backyard, where he organizes barbecues.

Now, imagine you have a piece of paper with Sam’s house written on it, and you want to share it with your friends so they visit him for his birthday. Instead of writing “Sam’s house,” you can simply write “Sammy’s” or “Samson’s” on the paper. When your friends see these nicknames, they’ll know where to go: both point to Sam’s house.

👉 In this analogy, Sam’s house is a site’s canonical domain name, and the nicknames “Sammy” and “Samson” are domain name aliases pointing to that canonical domain name:

  • Sam’s house = site’s canonical domain name.
  • Sammy’s = domain name alias with a CNAME record pointing to the site’s canonical domain name.
  • Samson’s = domain name alias with a CNAME record pointing to the site’s canonical domain name.

It’s important to note that while CNAME records facilitate this aliasing process within the DNS system, they don’t perform a direct URL redirection. Just think about it: the nicknames “Sammy’s” and “Samson’s” will take you to Sam’s house but to different places. One takes you to his porch and the other to his backyard, but neither takes you inside Sam’s house.

👉 To illustrate, consider a scenario:

  • might have a CNAME that directs to, leading the visitor to’s corresponding IP address.
  • Once the visitor connects to that IP address, the web server scrutinizes the URL to identify it as coming from
  • Subsequently, the web server displays the content associated with the page instead of the homepage (

Why are CNAME records useful?

A CNAME record is helpful because, as a website owner, it allows you to associate multiple domain names with a single IP address or hostname.

👉 These are the most common ways to use CNAME records in your site:

  • Alias subdomains: use CNAME records to point subdomains to other domains or subdomains, like to
  • Network services hosting: assign separate hostnames for network services like email or FTP, directing them to the root domain name. E.g., route services using CNAME records to point to
  • Multi-country domain registration: register the same domain in multiple countries and point the country-specific versions to the main .com domain. E.g., point domain names like or to via CNAME records.
  • Content Delivery Networks (CDNs): redirect users to a CDN by adding the CDN’s address as a CNAME for the origin server, enhancing content delivery. E.g., if you’re using a CDN like Cloudflare, you can set up a CNAME record to point to Cloudflare’s domain to serve cached content efficiently.
  • Migration and redirection: temporarily redirect traffic during transitions using CNAME records. E.g., redirect users from your old site ( to the new one ( during a website migration by creating a CNAME record that points the old domain name to the new one.
  • DNS management and maintenance: reduce complexity by using CNAME records instead of multiple A records for related subdomains. E.g., instead of setting multiple A records for associated services like,, and, create CNAME records pointing to a single domain. Then, any changes to the IP address can be managed in one place, simplifying maintenance.

How to find the CNAME record of any domain

👉 The easiest way to find the CNAME record of a domain is by using a CNAME lookup tool:

1. Go to a CNAME lookup tool like

Using to perform a CNAME record lookup.

2. Make sure you have the CNAME value selected under the search box.

Selecting the CNAME value in the tool.

3. Write a domain name in the search box and press Search.

Writing a domain name in the search box of the website.

4. Check the results.

Checking the CNAME record search results on

For our example, we checked the CNAME record for The results show that this domain name has a CNAME record pointing to

⚠️ Important: before checking the CNAME record for a domain name, note that not all domains have CNAME records. These record types are optional and are used for specific purposes, such as the ones described in a prior section of this article.

CNAME record examples

CNAME from subdomain to root domain

NameRecord typeValue

In this example, the CNAME record for directs to, and the A record for points to the relevant IP address.

CNAME from subdomain to subdomain

NameRecord typeValue

Here, the CNAME record for points to, and the A record for provides the corresponding IP address.

CNAME from subdomain to external domain

NameRecord typeValue

The CNAME record for points to the third-party blogging platform’s domain,, and the A record for provides the IP address.

Restrictions on CNAME records

👉 These are the main restrictions or limitations CNAME records have:

  • CNAME at the root level: Traditional DNS standards discourage the use of CNAME records at the root domain level, primarily because the root domain is also the DNS Start of Authority (SOA) and is required to have certain types of records that cannot coexist with a CNAME. However, it’s worth noting that some modern DNS providers offer a workaround known as “CNAME flattening.” This feature lets you point your root domain to another domain without violating DNS specifications. Keep in mind, this is not a universally accepted or available option and depends on your DNS provider.
  • MX and NS records: According to DNS standards, MX (Mail Exchange) and NS (Name Server) records cannot point to a CNAME alias. MX records are used to specify the mail servers responsible for receiving email messages on behalf of a domain, while NS records designate the authoritative DNS servers for a domain. For the effective functioning of these services, MX and NS records must point directly to A records (for IPv4) or AAAA records (for IPv6).
  • Email domain considerations: While you can use CNAME records for various services in your domain, caution is needed when it comes to email services. Specifically, MX and TXT records related to email must point directly to A or AAAA records to ensure the proper functioning of your email exchange and to prevent unexpected issues with various mail servers.

By understanding these limitations and considerations, you can manage your CNAME records more effectively and avoid common pitfalls.

CNAMEs and Alternative Record Types

In this guide, we’ve focused on a specific DNS record type: the CNAME. These are the four other major DNS record types:

A record

An A record maps a domain name to an IP address, directing users to the correct server for a website or service.

NameRecord typeValue

AAAA record

An AAAA record maps a domain name to an IPv6 address, enabling connectivity for users accessing websites via IPv6.

IPv6 is the latest version of the Internet Protocol.

NameRecord typeValue

NS record

An NS record specifies the authoritative name servers for a domain, guiding DNS queries to the correct source for domain information.

Put simply, the NS record guides web browsers and similar internet applications to the place where they can discover the IP address linked to a domain name.

NameRecord typeValue

MX record

An MX record shows which servers handle emails for a domain, making sure the servers deliver emails correctly.

NameRecord typeValue

Wrapping up

So, as we’ve learned today, CNAME records do a very important job: they point domain aliases to IP addresses to help your browser understand where to go.

Now that you’re well-versed in CNAME records, you’re one step away from optimizing your domain management strategy, transforming aliases into canonical domain names, and simplifying DNS management.

Just remember that CNAME records aren’t merely technical tools. They’re your allies in crafting a seamless online presence. 💡

👉 For more insights on DNS, check out our article on DNS load balancing and why it matters.