
07
A Record vs CNAME: What Is the Difference and Which Should You Use?
Learn the difference between an A record and CNAME record, when to use each one, and how to choose the right DNS record for your domain, website, or subdomain.
When you connect a domain to a website or online service, you may be asked to create an A record or a CNAME record. Both are common DNS records, but they are used in different ways.
An A record points a hostname to an IPv4 address. A CNAME record points a hostname to another hostname.
That difference sounds simple, but it can become confusing when you are setting up a website, subdomain, CDN, SaaS platform or hosting service.
This guide explains A record vs CNAME in simple terms. You will learn what each record does, when to use it, common mistakes to avoid and how to check your DNS records before making changes.
Read More
New to DNS? Read DNS Lookup: How to Check DNS Records for Any Domain to learn how A, AAAA, CNAME, MX, TXT and NS records work and how to check them.
What Is an A Record?
An A record connects a hostname to an IPv4 address.
For example:
example.com → 192.0.2.10
The IPv4 address tells DNS where the hostname should connect.
A records are commonly used when a hosting provider gives you a specific IPv4 address for your website or application.
Example of an A Record
example.com A 192.0.2.10
When someone requests the A record for example.com, DNS can return the IPv4 address configured in the record.
What Is a CNAME Record?
A CNAME record creates an alias from one hostname to another hostname.
For example:
www.example.com CNAME example.com
In this case, www.example.com does not directly contain an IPv4 address. It points to another hostname.
The DNS system can then resolve the target hostname to find the appropriate address.
Example of a CNAME Record
app.example.com CNAME service.example.net
This type of setup is common when a third-party service gives you a hostname that you should use for your subdomain.
A Record vs CNAME: The Simple Difference
The easiest way to remember the difference is:
- A record: hostname → IPv4 address
- CNAME: hostname → hostname
For example:
example.com A 192.0.2.10 www.example.com CNAME example.com
The first record points directly to an IPv4 address.
The second record makes www.example.com an alias of example.com.
A Record vs CNAME Comparison
FeatureA RecordCNAME RecordPoints to | IPv4 address | Another hostname
Main purpose | Direct IP mapping | Hostname alias
Common use | Web servers and hosting | Subdomains and third-party services
Root domain | Can be used | Traditional CNAME cannot be used at the zone apex
Target | IPv4 address | Hostname
When Should You Use an A Record?
An A record is normally appropriate when you have an IPv4 address that should be used for the hostname.
You may use an A record when:
- Your hosting provider gives you an IPv4 address.
- You control a server with a known public IPv4 address.
- Your provider specifically asks you to create an A record.
- You need a direct hostname-to-IPv4 mapping.
Example
Your hosting company gives you this address:
203.0.113.25
And tells you to point your domain to it.
You would normally create:
example.com A 203.0.113.25
That is a straightforward A record configuration.
When Should You Use a CNAME?
A CNAME is normally appropriate when the destination is another hostname rather than an IP address.
You may use a CNAME when:
- A SaaS provider gives you a hostname.
- A CDN gives you a hostname to point your subdomain to.
- You are connecting a subdomain to an external service.
- The destination service manages its own infrastructure and IP addresses.
For example:
app.example.com CNAME customer.service-provider.com
The service provider can manage the destination behind that hostname without requiring you to maintain its IP address yourself.
A Record vs CNAME for a Website
There is no single record type that is correct for every website.
The right choice depends on what your hosting provider gives you.
If the provider gives you an IPv4 address, an A record is usually the expected option.
If the provider gives you a hostname, a CNAME may be the expected option for a hostname that supports it.
Always check the DNS instructions from the service you are connecting because providers can have different requirements.
A Record vs CNAME for Subdomains
Subdomains are a common place to use CNAME records.
For example:
blog.example.com shop.example.com app.example.com docs.example.com
If an external platform gives you a hostname for one of these services, you may be asked to create a CNAME.
For example:
shop.example.com CNAME store.provider.com
However, a subdomain can also use an A record when the destination is an IPv4 address.
shop.example.com A 192.0.2.20
So the important question is not whether a hostname is a subdomain. The important question is what destination the service requires.
Can You Use an A Record and CNAME Together?
You should not normally configure an A record and a CNAME for the same hostname.
For example, this is a conflicting configuration:
www.example.com A 192.0.2.10 www.example.com CNAME example.com
A CNAME has special rules that prevent it from normally sharing the same DNS name with other record data.
If you need both types of records, use different hostnames where appropriate.
For example:
example.com A 192.0.2.10 www.example.com CNAME example.com
The exact DNS design should still match your hosting and DNS provider's instructions.
Can You Use a CNAME for the Root Domain?
This is one of the most important points when comparing an A record vs CNAME.
The root domain is also called the zone apex.
For example:
example.com
A traditional CNAME cannot normally be placed at the zone apex because the apex needs other DNS information such as NS and SOA records.
Some modern DNS providers offer alternatives such as:
- ALIAS
- ANAME
- CNAME flattening
These features are provider-specific and can allow a root domain to follow a hostname without using a traditional apex CNAME.
What Is the Difference Between A and AAAA Records?
It is also useful to understand AAAA records when working with A records.
An A record points to an IPv4 address.
An AAAA record points to an IPv6 address.
A → 192.0.2.10 AAAA → 2001:db8::10
A hostname can have both A and AAAA records when it supports IPv4 and IPv6.
A CNAME is different because it points to another hostname rather than directly storing an IP address.
Why a CNAME Can Be Useful for SaaS and CDN Services
Many online platforms manage large infrastructure behind a hostname.
Instead of giving every customer a fixed IP address, a service may provide a hostname such as:
customer.service.example
The customer can then create a CNAME pointing their subdomain to that hostname.
This allows the service provider to manage its underlying infrastructure without asking every customer to update DNS whenever its infrastructure changes.
This is one reason CNAME records are common for managed services and subdomains.
Common A Record and CNAME Mistakes
Using an A Record With a Hostname
An A record requires an IPv4 address. You cannot simply enter a hostname where an IPv4 address is expected.
Using a CNAME With an IP Address
A CNAME points to another hostname. If a provider gives you an IPv4 address, check whether it expects an A record instead.
Adding a CNAME Where Another Record Already Exists
Check the existing records for the same hostname before creating a CNAME.
Creating a CNAME at the Root Domain
A traditional CNAME cannot normally be used at the zone apex. Check whether your DNS provider supports ALIAS, ANAME or CNAME flattening.
Ignoring an Existing AAAA Record
If you change an A record but leave an incorrect AAAA record in place, IPv6 users may still reach an unexpected destination.
How to Check A and CNAME Records Online
Before changing DNS, it is useful to check what is currently published.
You can use the AuraTools DNS Lookup tool to inspect DNS records for a domain or hostname.
Step 1: Enter the Domain
Enter the domain or hostname you want to check.
example.com
For a subdomain, check the exact hostname:
www.example.com
Step 2: Check the Record Type
Look for A, AAAA and CNAME records.
If an A record is returned, the hostname has an IPv4 mapping.
If a CNAME is returned, the hostname is configured as an alias to another hostname.
Step 3: Compare the Result
Compare the DNS result with the values provided by your hosting provider, CDN or SaaS platform.
A record can be valid but still point to the wrong server. A CNAME can also be valid but point to the wrong hostname.
How to Check A and CNAME Records With nslookup
Windows users can use nslookup from Command Prompt.
For an A record:
nslookup -type=A example.com
For a CNAME:
nslookup -type=CNAME www.example.com
For an AAAA record:
nslookup -type=AAAA example.com
How to Check A and CNAME Records With dig
macOS and Linux users can use dig.
To check an A record:
dig example.com A
To check a CNAME:
dig www.example.com CNAME
To check an AAAA record:
dig example.com AAAA
How to Choose Between A Record and CNAME
Use this simple checklist before editing your DNS settings:
- Did the provider give you an IPv4 address? An A record is normally the appropriate record type.
- Did the provider give you a hostname? A CNAME is normally appropriate when that hostname is intended as an alias target.
- Are you configuring the root domain? A traditional CNAME cannot normally be used at the zone apex.
- Does the same hostname need other DNS records? Be careful with CNAME because it cannot normally coexist with other records at the same name.
- Did your provider give exact DNS instructions? Follow those instructions instead of choosing a record type based only on general rules.
Check Your DNS Configuration With AuraTools
If you are not sure whether a hostname uses an A record or CNAME, checking the current DNS configuration is a good first step.
Use the AuraTools DNS Lookup tool to inspect the published DNS records.
If the DNS result contains an IP address and you want more information about it, you can use the IP Information tool.
You can also use IP to Hostname and Hostname to IP when investigating the relationship between hostnames and IP addresses.
Frequently Asked Questions
What is the difference between an A record and CNAME?
An A record points a hostname to an IPv4 address. A CNAME points a hostname to another hostname.
Should I use an A record or CNAME?
Use an A record when the destination is an IPv4 address. Use a CNAME when the service gives you a hostname as the destination and the hostname can use a CNAME.
Can an A record and CNAME exist together?
They should not normally exist for the same hostname because a CNAME cannot normally coexist with other DNS record data at that name.
Can I use a CNAME for my root domain?
A traditional CNAME cannot normally be used at the DNS zone apex. Some DNS providers offer ALIAS, ANAME or CNAME flattening as alternatives.
Is a CNAME better than an A record?
Neither is universally better. An A record is useful for direct IP mapping, while a CNAME is useful when a hostname should follow another hostname.
Can I have both A and AAAA records?
Yes. A records provide IPv4 addresses while AAAA records provide IPv6 addresses.
How can I check whether my domain uses A or CNAME?
You can use the AuraTools DNS Lookup tool to inspect the published DNS records.
Contact
Missing something?
Feel free to request missing tools or give some feedback using our contact form.
Contact Us