All In One Tools logo
Blog
26 October 2026

A Record vs CNAME Record

A Record vs CNAME Record

A Record vs CNAME Record: What’s the Difference?

When managing a domain name, you may come across DNS settings such as A records and CNAME records. Both help direct visitors to the right destination, but they work in different ways. Choosing the correct record is important for connecting your domain to a website, setting up subdomains, and maintaining a reliable online presence.

In this guide, you’ll learn what A and CNAME records are, how they work, the key differences between them, and when to use each one.

What Is a DNS Record?

DNS stands for Domain Name System. It translates easy-to-remember domain names, such as example.com, into information that computers use to locate online services.

DNS records are instructions stored in a domain’s DNS zone. They tell browsers and other internet services where to find a website, which mail servers handle email, and other information about a domain.

Two common DNS record types are:

  • A record: Connects a hostname to an IPv4 address.
  • CNAME record: Makes one hostname an alias of another hostname.

What Is an A Record?

An A record, also called an Address record, maps a domain or subdomain to an IPv4 address.

An IPv4 address looks like this:

192.0.2.10

For example, your DNS settings might contain this record:

TypeNameValue
A@192.0.2.10

Here, @ commonly represents the root domain, such as example.com. The record tells DNS resolvers that the hostname should resolve to the specified IPv4 address.

When Should You Use an A Record?

An A record is useful when:

  • You want your domain to point directly to a server’s IPv4 address.
  • Your hosting provider gives you an IP address for your website.
  • You want a subdomain, such as app.example.com, to point to a specific IPv4 address.
  • You need to configure a domain using the DNS settings supplied by your hosting provider.

Example: If your web host tells you to point example.com to 192.0.2.10, you would typically create an A record with that value.

Always use the IP address provided by your actual hosting provider. The address above is only an example.

What Is a CNAME Record?

A CNAME record, or Canonical Name record, makes one hostname an alias of another hostname.

Unlike an A record, a CNAME does not directly store an IPv4 address. Instead, it points to another hostname, which DNS can then resolve to its destination.

For example:

TypeNameValue
CNAMEwwwexample.com

This configuration makes www.example.com an alias of example.com.

If the destination hostname’s address changes, the CNAME can continue pointing to that hostname without requiring you to update the alias with the new IP address.

When Should You Use a CNAME Record?

A CNAME record is useful when:

  • You want www.example.com to point to example.com.
  • A third-party service asks you to connect a subdomain using a target hostname.
  • You want an alias to follow the destination hostname when its DNS address changes.
  • You are connecting a service such as a hosted application or another platform that provides a canonical hostname.

Example: A service may ask you to create a CNAME for portal.example.com pointing to a hostname it provides. Follow the service’s exact DNS instructions.

A Record vs CNAME Record: Key Differences

Although both records help DNS locate destinations, their main difference is the type of value they store.

FeatureA RecordCNAME Record
PurposeMaps a hostname to an IPv4 addressMaps a hostname to another hostname
Destination valueIPv4 addressCanonical hostname
Example value192.0.2.10example.com
Follows another hostname’s DNS destinationNo, it stores the IP directlyYes, it aliases the target hostname
Common usePointing a domain to a server IPCreating a hostname alias
Root domain supportCommonly used for the root domainGenerally cannot coexist with other records at the same name; root-domain CNAMEs are not supported by standard DNS behavior

One important detail: a CNAME record generally cannot exist alongside other DNS records for the same hostname. This is why a CNAME is commonly used for a subdomain such as www, while the root domain often uses an A record or another supported DNS configuration.

Some DNS providers offer special root-domain features, such as ALIAS, ANAME, or CNAME flattening. These are provider-specific solutions rather than ordinary CNAME records.

Can You Use A and CNAME Records Together?

Yes. You can use both record types in the same domain’s DNS zone, as long as they are configured for different hostnames and do not conflict.

For example:

TypeNameValue
A@192.0.2.10
CNAMEwwwexample.com
CNAMEshopstore.example-host.com

In this example:

  • The root domain example.com points to an IPv4 address.
  • www.example.com aliases the root domain.
  • shop.example.com aliases a hostname supplied by an external service.

This is a common setup for websites that use a main domain, a www version, and separate hosted services.

However, DNS records must follow the rules of the DNS system and your provider. Do not add a CNAME to a hostname that already has incompatible records.

How to Add an A Record

The exact steps depend on your domain registrar or DNS hosting provider, but the general process is similar.

  1. Sign in to your domain registrar or DNS hosting account.
  2. Open the DNS management or DNS zone settings.
  3. Select the option to add a new record.
  4. Choose A as the record type.
  5. Enter the hostname, such as @ for the root domain.
  6. Enter the IPv4 address supplied by your hosting provider.
  7. Set the TTL if required, or keep the provider’s default.
  8. Save the record and allow time for DNS changes to become visible.

Before making changes, note your existing DNS configuration. Incorrect records can make your website or other services unavailable.

How to Add a CNAME Record

To add a CNAME record, follow these general steps:

  1. Sign in to your DNS hosting account.
  2. Open the DNS records for your domain.
  3. Add a new record and select CNAME.
  4. Enter the hostname or subdomain, such as www or portal.
  5. Enter the destination hostname supplied by your provider.
  6. Configure the TTL if needed.
  7. Save the record.

For example, if your service tells you to point portal.example.com to customer.service-provider.com, the host field might be portal and the target field might be customer.service-provider.com.

The precise field names vary between DNS providers. Copy the target hostname carefully, and follow any additional verification instructions from the service.

How Long Do A and CNAME Changes Take?

DNS changes are not always visible everywhere immediately. The time required depends on factors such as the record’s TTL, caching by DNS resolvers, and the provider’s setup.

A low TTL can allow cached information to expire sooner, but it does not guarantee instant updates. Some changes may become visible quickly, while others can take longer.

If your website is not working after a DNS update:

  • Check that the hostname and destination value are correct.
  • Confirm that the record was saved in the authoritative DNS zone.
  • Check whether another record conflicts with the new one.
  • Verify the DNS configuration using your provider’s tools or a DNS lookup utility.
  • Confirm that your hosting provider has completed any required domain verification.

Common A Record and CNAME Mistakes

Avoid these common DNS configuration errors:

1. Entering a hostname Instead of an IP Address in an A Record

An A record expects an IPv4 address, not a domain name. If your provider supplies a hostname rather than an IP address, check whether it requires a CNAME or another supported configuration.

2. Entering an IP Address as a CNAME Target

A CNAME target should be a hostname, such as example.com, not an IPv4 address.

3. Creating a CNAME at the Root Domain

A standard CNAME generally cannot be used at the root domain alongside the other records normally required there. Check whether your provider supports a special root-domain alias feature or use the record types recommended by your DNS host.

4. Creating Conflicting Records

A hostname with a CNAME generally cannot also have separate A, MX, or TXT records at that same name. Review existing records before adding a new one.

5. Using the Wrong Target Hostname

When connecting an external service, use the exact target hostname provided by that service. Guessing the destination may prevent the domain from connecting properly.

6. Expecting DNS Changes to Apply Instantly

Cached DNS information can remain available until its TTL expires. Check your configuration and allow time for caches to refresh before making repeated changes.

Which One Should You Choose: A Record or CNAME?

The right choice depends on the information your hosting or service provider gives you.

  • Choose an A record when you need to point a hostname directly to an IPv4 address.
  • Choose a CNAME record when you need a hostname to alias another hostname.
  • Follow your provider’s instructions when connecting a website, email service, CDN, or hosted application.

For example, if your hosting provider gives you a server IP address, an A record is usually appropriate. If an external platform gives you a destination hostname for a subdomain, a CNAME is often the right option.

Do not change DNS records simply to try both options. First confirm the required record type with your hosting or service provider.

Conclusion

A records and CNAME records both help connect domain names to online destinations, but they serve different purposes. An A record maps a hostname to an IPv4 address, while a CNAME record makes one hostname an alias of another.

Use an A record when you have a server IP address to configure, and use a CNAME when a service requires a hostname alias. Understanding this distinction can help you avoid common DNS errors and maintain a reliable website.

If you need to investigate your domain’s configuration, try our DNS Lookup tool and read our related guide, What Is DNS Lookup and Why Website Owners Need It.

Frequently Asked Questions (FAQs)

1. What is the main difference between an A record and a CNAME record?

An A record points a hostname to an IPv4 address, while a CNAME record points a hostname to another hostname.

2. Is a CNAME better than an A record?

Neither is universally better. An A record is appropriate when you need to specify an IPv4 address. A CNAME is useful when a hostname needs to alias another hostname.

3. Can I use a CNAME for my root domain?

A standard CNAME generally cannot be used at the root domain when other records are required there. Some DNS providers offer special features such as ALIAS, ANAME, or CNAME flattening. Check your provider’s documentation.

4. Can a domain have multiple A records?

Yes. A hostname can have multiple A records pointing to different IPv4 addresses. The correct setup depends on your hosting, load-balancing, and DNS requirements.

5. Can I create an A record and a CNAME for the same hostname?

Generally, no. A CNAME cannot coexist with other ordinary DNS records at the same hostname. Use different hostnames or follow your DNS provider’s supported configuration.

6. Does a CNAME redirect visitors to another website?

No. A CNAME is a DNS alias, not an HTTP redirect. It helps resolve the hostname to its DNS destination; it does not automatically change the URL shown in the browser.

7. How long does it take for a DNS record to update?

It depends on TTL settings, DNS caching, and provider configuration. Some updates appear quickly, but others take longer to become visible across different resolvers.

Written by

SEO Specialist

Ruby Hanif is an SEO specialist who works on local SEO, Google Business Profile optimization, SEO audits, and on-page and off-page SEO. Ruby carries out technical audits, keyword research and content optimization using tools such as Ahrefs, Semrush, Surfer SEO, GA4 and BrightLocal, and writes the guides on the All In One Tools blog.

More articles by Ruby Hanif LinkedIn Published 26 October 2026

Related Articles