What is a CNAME Record?

Last Updated on January 2, 2023 by 8 Comments

Editorial Note: We may earn a commission when you visit links on our website.
What is a CNAME Record?
Blog / WordPress / What is a CNAME Record?
Play Button

Weโ€™ve previously talked about how the Domain Name System (DNS) works, but this isnโ€™t the whole picture. There are lots of additional cogs that make up the wheel, and so far we havenโ€™t discussed some of the most common elements, such as CNAME records.

For this article, weโ€™ll answer the question of what a CNAME record is, and show you several variants that you can use. Then weโ€™ll talk about the limitations youโ€™ll experience, and finally show you how to add them for your domain.

Letโ€™s get to it!

Subscribe To Our Youtube Channel

What Is a CNAME Record?

At its core, the DNS works by mapping domain names to specific IP addresses. When you type a URL in your browser, it looks up the corresponding IP address through the DNS and leads you to the website you want to visit.

However, this is just one type of record the DNS uses. With CNAME records, you can map URLs as aliases to your canonical domain. This means if the IP address mapped to that canonical domain changes, your CNAME records will stillย work because they point to the root domain.

To offer a real-world example, letโ€™s say you have these three URLs:

  1. yourwebsite.com
  2. www.yourwebsite.com
  3. yourwebsite.io

URL number one would be your siteโ€™s canonical domain, which points towards your siteโ€™s IP address. In practice, youโ€™d need to set up a CNAME record that redirectsย www.yourwebsite.comย visitors towardsย yourwebsite.com.

At the same time, we also have the same name registered using a different Top-Level Domain (TLD). This means youโ€™d want to create a second record that redirects address three towards number one. All of that usually happens through your domain registrar or whichever service you use to manage the URLs that you โ€œownโ€.

2 Examples of CNAME Records

In fact, CNAME entries come in many shapes and sizes. However, in most cases youโ€™ll only need to set up one CNAME record for a new website โ€“ typified by the wwwย example we just mentioned.

In a later section, weโ€™re going to show you how to set up a similar record through your registrar. First, letโ€™s go over three more examples in closer detail.

1. Setting Up Separate Hostnames for Services Such as File Transfer Protocol (FTP) or Email

If you want to access your website via FTP using a domain such asย ftp.yourwebsite.com, youโ€™ll need to set up a corresponding FTP CNAME record:

Setting up an FTP CNAME record.

This same approach applies to CNAME records for additional services that you use, such as email. Here, youโ€™d want to set a โ€œhostnameโ€ such as โ€œmailโ€ instead:

Creating a mail CNAME record.

Those records would correspond to the following two URLs:

  1. ftp.yourdomain.com
  2. mail.yourdomain.com

With most registrars, you can either enter the full hostname (those two URLs you see above) or an abbreviation such asย www,ย ftp,ย andย mail.

2. Pointing Addresses With Different TLDs Towards a โ€œMainโ€ Domain

In some cases, it pays off to register the same domain name using different TLDs. For example, you can set up a CNAME record for yourdomain.orgย that points towardsย yourdomain.com.ย Hereโ€™s how the record would look:

Configuring a new CNAME record.

Itโ€™s important to understand that you need to add this type of CNAME record to the domain you want to point towards a different URL. In other words, you canโ€™t point a root level domain towards another using a CNAME record. Root domains, such asย yourdomain.comย need to be mapped towards an IP address.

Using this same approach, you can map entirely different domains to a root URL. Letโ€™s go over how the mapping process works, so you know where to start.

How to Add CNAME Records For Your Domain

Adding new CNAME records works largely the same with most registrars, although the interface that each one uses might be different. To show you how this works, weโ€™re going to set up a basic record to point a wwwย URL towards its canonical domain. For starters, youโ€™ll want to open your domainโ€™s settings through your registrar.

For example, if youโ€™re using Namecheap, the registrar includes an Advanced DNSย tab for each domain you own. Within the tab, you can add multiple types of records (there are more options beyond CNAME!).

In the example below, you can see an โ€œAโ€ record. This is a type of record that maps your canonical domain towards your siteโ€™s IP address.

An example of an A record.

To add a record, youโ€™d need to click on ADD NEW RECORDย and selectย CNAME Recordย underย Record Type:

Adding a new CNAME record.

Underย Hostย you need to enter theย wwwย prefix for this particular example. Now add your websiteโ€™s canonical domain underย Target:

Pointing a www URL towards a canonical URL.

Finally, thereโ€™s one last setting calledย TTL. This acronym stands for โ€œTime to Liveโ€ and it tells your nameservers how often they should update your DNS records. As you might know, DNS records take some time to โ€œpropagateโ€ and become accessible globally. The lower your TTL time is, the shorter the wait should be.

In most cases, we recommend leaving this setting to Automaticย as DNS records usually propagate fast enough. For now, save your new record, which should appear under its A sibling:

A and CNAME records.

Keep in mind that you can set up multiple CNAME records depending on your needs. In the previous section, we explored multiple options, and all of them can be set up concurrently.

What youย canโ€™tย do is set up records that direct the same domain towards different canonical URLs. This means you couldnโ€™t set up two records pointing www.yourdomain.comย towardsย yourdomain.comย andย alternatedomain.com. If youโ€™re setting up a new website, most times youโ€™ll only need to create two records for everything to work. Those would be one A and one CNAME record.

Conclusion

CNAME records are a core component of the DNS. If you need to point domains towards one another (instead of towards an IP address), youโ€™ll need to use CNAME records.

There are several uses for CNAME records, but two of the most common uses include:

  1. Setting up separate hostnames for services such as FTP or email.
  2. Pointing addresses with different TLDs towards a โ€œmainโ€ domain.

Do you have any questions about how to use CNAME records? Letโ€™s talk about them in the comment section below!

Article thumbnail image by DiA99 / shutterstock.com

Divi Anniversary Sale

It's The Divi Anniversary Sale! Save Big For A Limited Time ๐Ÿ‘‡

Save big on Divi and Divi products for a limited time.

Access The Sale
Divi Anniversary
Premade Layouts

Check Out These Related Posts

On-Page SEO Checklist (Every Task For New & Existing Pages)

On-Page SEO Checklist (Every Task For New & Existing Pages)

Updated on March 10, 2025 in WordPress

On-page SEO is the foundation of a strong search strategy and the most controllable way to influence a pageโ€™s visibility. It focuses on individual pages of content that are optimized for search engines and users, making it easier to rank and attract organic traffic. From keyword targeting to...

View Full Post
WordPress Security Threat Update (4 Trends in 2025)

WordPress Security Threat Update (4 Trends in 2025)

Posted on March 6, 2025 in WordPress

Many WordPress users rely solely on security plugins for protection. While these plugins add a layer of security, they arenโ€™t often enough to protect your WordPress website completely, especially when cybercriminals are getting smarter. With AI on the rise, hackers can now mass-scan WordPress...

View Full Post

8 Comments

  1. I have a question – I am changing my hosting from blogspot to blue host, so can I keep the same CNAME in the domain DNS settings or delete it..

    • Hi Patrika! I would contact BlueHost support and ask if there’s anything you need to do here. That way you know you’ll be getting an answer tailored to the platforms you’re working with.

  2. As a web host, I suggest that using a CNAME record for mail.example.com might end up leading to confusion.

    It is not at all uncommon to have DNS hosting plus email at one service and a website at another e.g. Squarespace, that doesn’t provide email. In this case the A record and MX records need to be different. The MX will need to point to (for example) mail.example.com and in turn that will need an A Record, not a CNAME.

    While I understand this blog is targetted at WordPress users the information is useful for everyone and should take them into account.

    • Thanks for your insight, Steve!

  3. Thanks for the article. Could you write one that goes through every single step in excruciating detail for separating the mail to go to gmail.com, outlook.com, and a couple more of the most popular business mail providers? The one I saw earlier didn’t go into how to set the whole thing up on a particular service.

    • Glad you liked the article! Thanks for your suggestion โ€“ it would be an interesting post to write. I’ll pass it along.

  4. Can I use Cname recotds to map domains to a subdomain? This question is in regards to setting up a WordPress multi-site.

    • Yes, Clay, you absolutely can use CNAME records for subdomain mapping! If you do a quick Google search, there are many tutorials for this available.

Leave A Reply

Comments are reviewed and must adhere to our comments policy.

๐Ÿ‘‹ It's The Divi
Anniversary Sale!
Get The Deal
Before It's Gone!
Get Started With Divi